Find Minimum in Rotated Sorted Array

Medium ArrayBinary Search

Approaches

?

Insight Challenge

If nums[mid] > nums[right], where must the minimum be?

Narrow down candidates by eliminating impossible regions

A rotated sorted array has a special property: it consists of two sorted subarrays. The minimum element is at the boundary between them (the rotation point). By comparing the middle element with a reference point, we can determine which half contains the rotation point and eliminate the other half. This allows us to reduce the search space by half each iteration.

Algorithm

  1. Define the search boundaries at array start and end
  2. While multiple candidates remain:
  3. Examine the middle element
  4. If middle is greater than rightmost, the break point is in the right half
  5. Otherwise, the break point is in the left half (including middle)
  6. Return the element at the converged position

Solution

Time O(log n) Space O(1)
def find_min(nums):
    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]
ByteLingo

See algorithms come alive.

© 2026 ByteLingo