Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). Find the minimum element. The array may contain duplicates.
array = [1,3,5]
1
As evident from the array, 1 is the minimum element in the array
O(log(N)), where N is the size of the array.
O(1),Auxilliary Space
1 <= nums.length <= 5000
-10^4 <= nums[i] <= 10^4
All values of nums are unique. nums is guaranteed to be rotated at some pivot.
-10^4 <= target <= 10^4