153. Find Minimum in Rotated Sorted Array
Practice Find Minimum in Rotated Sorted Array for free on NudgeCode: Medium, Binary Search pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
nums holds distinct values that were sorted ascending and then rotated by some amount (possibly zero), so a sorted prefix may have been moved to the end. Return the smallest value in O(log n).
Example
nums = [3,4,5,1,2] -> 1
Constraints
- 1 <= nums.length <= 5000
- All values are distinct
- -5000 <= nums[i] <= 5000