mediumBinary SearchBinary Search

Find Minimum in Rotated Sorted Array

mediumTime: O(log n)Space: O(1)

Recognize the pattern

sorted array that was rotatedfind the minimum elementthe prompt wants you to keep cutting the search space down

Brute force idea

The naive version of Find Minimum in Rotated Sorted Array sounds like this: Linear scan to find where the descent happens. Ignores the sorted structure entirely. That direct path helps you understand the question, but it tends to treat every possibility as brand new instead of learning from earlier steps.

Better approach

A calmer way to see Find Minimum in Rotated Sorted Array is this: Binary search: compare mid to right. If mid > right, the minimum is in the right half (the rotation break is there). If mid ≤ right, the minimum is in the left half including mid. The goal is not to be clever for its own sake, but to remember the one relationship that keeps the solution grounded as you move forward.

Key invariant

The truth you want to protect throughout Find Minimum in Rotated Sorted Array is this: The minimum is always at the rotation point — where the sorted order breaks. One half of the array around mid is always fully sorted; the minimum is in the other half. If that remains true after every update, the rest of the reasoning has a stable place to stand.

Watch out for

One easy way to drift off course in Find Minimum in Rotated Sorted Array is this: Comparing mid to left instead of right. Comparing to right is cleaner because it directly tells you which half contains the rotation point. The fix is usually to return to the meaning of each move, not just the steps themselves.

Binary Search Pattern