Find Minimum in Rotated Sorted Array

Find the minimum element in a rotated sorted array.

Pattern

Modified Binary Search

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.

Approach

How to Solve It

If mid > right, min is in right half. Otherwise, min is in left half (including mid).

Key Insight

Compare mid with right (not left) — if mid > right, the rotation point (minimum) must be between mid+1 and right.

Step-by-step

  1. 1Set left = 0, right = len(nums) - 1
  2. 2While left < right:
  3. 3Calculate mid
  4. 4If nums[mid] > nums[right], the minimum is in the right half
  5. 5Otherwise, the minimum is in the left half (including mid)

Pseudocode

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]
Complexity Analysis

Time Complexity

O(log n)

Space Complexity

O(1)
More Binary Search Problems

Master this pattern with YeetCode

Practice Find Minimum in Rotated Sorted Array and similar Binary Search problems with flashcards. Build pattern recognition through active recall.

Practice this problem