Find Minimum in Rotated Sorted Array

Med
Concept
Code
Loading editor...
Tap Analyze to see visualization
Variables

Run code to see variables

Output

Console output will appear here

Press Space to start to step? all shortcuts

Solution Guide: Find Minimum in Rotated Sorted Array

Approach

Compare mid element to the rightmost element. If mid is greater, the rotation point (minimum) must be to the right. Otherwise, it is at mid or to the left. Narrow until left meets right.

Complexity Analysis

Time
O(log n)
Space
O(1)

Pattern

Binary Search (Rotated Array)

Why It Works

If mid element is greater than right element, the minimum must be in the right half (the rotation point is there). Otherwise, it is in the left half including mid.

Updated Feb 2026