Rotated List Minimum
A list of distinct integers was sorted in ascending order and then rotated at an unknown pivot (for example [0, 1, 2, 4, 5] became [4, 5, 0, 1, 2]). Return its minimum.
Requirements
- time.
Constraints
- ; all values are distinct.
Examples
EXAMPLE WALKTHROUGHrotated
A guided view of the published example, not a trace of your code.
INPUT
[[3,4,5,1,2]]TASKrotated_list_minimum()
EXPECTED OUTPUT
1Start with the input values shown in this example.
Example 1 of 3
Input: nums = [3,4,5,1,2]
Output: 1
Explanation: rotated
Input: nums = [4,5,6,7,0,1,2]
Output: 0
Explanation: longer
Input: nums = [11,13,15,17]
Output: 11
Explanation: not rotated
Hint 1
Compare the middle value with the last value.
Hint 2
If nums[mid] > nums[hi], the minimum is to the right of mid; otherwise it is at mid or to its left.