139. Find Minimum in Rotated Sorted Array

MediumBinary Search

Suppose an array of n unique integers sorted in ascending order is rotated between 1 and n times. For example, [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2] after rotating 4 times. Given the sorted rotated array nums, return the minimum element of this array. You must write an algorithm that runs in O(log n) time.

Examples

Input: [7,8,9,10,11,12,1,2,3,4,5,6]

Output: 1

Explanation: Public test case for Find Minimum in Rotated Sorted Array

Constraints

  • 1 <= nums.length <= 5000
  • All integers are unique.
Loading...

Run checks all cases above. Submit evaluates all test cases.