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.
Input Format
Input is managed for you
Output Format
Output is managed for you
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.
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
6 5 6 1 2 3 4
Output
1