Find Minimum In Rotated Sorted Array
easy
1. Suppose an array of length n sorted in ascending order is rotated between 1 and n times. 2. Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]]. 3. Given the sorted rotated array nums of unique elements, return the minimum element of this array. 4. You must write an algorithm that runs in O(log n) time.
Constraints
n == nums.length 1 <= n <= 5000 -5000 <= nums[i] <= 5000 All the integers of nums are unique. nums is sorted and rotated between 1 and n times.
Format
Input
Input is managed for you
Output
Output is managed for you
Example
Sample Input
6
5 6 1 2 3 4
Sample Output
1
Question Video