← Visualizers
Binary Search — Rotated Arrays LeetCode 153

Find Minimum in Rotated Sorted Array / visualized

No target to search for this time — just converge left and right onto the single index holding the minimum. The trick: compare nums[mid] against nums[right] — not nums[left]. If mid is bigger than the right end, the rotation point (and the minimum) is somewhere after mid. Otherwise, mid itself could be the minimum, so it stays in range.

Execution

idle
Press Run to begin.
0 / 0
Speed

Java · running line

left mid right minimum
O(log n) time · O(1) space  ·  loop condition is left < right (not ≤) — the moment they meet, that index is the answer.