Modified Binary search

  • 0

    We can find the minimum element in the rotated array by using the binary search method. We can split the array into two halves. If the two halves are in order, then return minimum of the minimum of each half. If the left half is in order but right, then min is in right. If the left has is not in order, then min is in left. Recursively move either left or right, till both the halves are in order.

    Its easy to come up with this logic, but need to be careful on adjusting/checking low, high & mid :-).

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.