Single element in a sorted array | Leetcode #540

Techdose
Techdose
54.3 هزار بار بازدید - 4 سال پیش - This video explains a very
This video explains a very important programming interview  question which is to find the unique element in a sorted array in just O(logN) time and O(1) extra space. This problem would have been extremely easy to solve provided we were allowed O(N) time. This can be solved by simple linear search  or XOR operation. In order to take benefit of sorted array property, we can use binary search algorithm  with some observations to find the unique element in just O(logN). I have shown 4 observations and used them to solve the problem in O(logN) time using binary search algorithm.At the end of the video, i have explained the CODE. CODE LINK is present below as usual. If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)


CODE LINK: https://gist.github.com/SuryaPratapK/...
4 سال پیش در تاریخ 1399/02/23 منتشر شده است.
54,396 بـار بازدید شده
... بیشتر