Find the minimum element in a rotated sorted array.
This problem follows the Modified Binary Search pattern, commonly found in the Binary Search category. Recognizing this pattern is key to solving it efficiently in an interview setting.
If mid > right, min is in right half. Otherwise, min is in left half (including mid).
Compare mid with right (not left) — if mid > right, the rotation point (minimum) must be between mid+1 and right.
left, right = 0, len(nums) - 1
while left < right:
mid = (left + right) // 2
if nums[mid] > nums[right]:
left = mid + 1
else:
right = mid
return nums[left]Practice Find Minimum in Rotated Sorted Array and similar Binary Search problems with flashcards. Build pattern recognition through active recall.
Practice this problem