Skip to main content
mediumBlind 75

Search in Rotated Sorted Array

Given a rotated sorted array and a target value Return the index of target, or -1 if not found Must run in O(log n) time Example: [4,5,6,7,0,1,2], target = 0 => 4 Example: [4,5,6,7,0,1,2], target = 3 => -1

Search in Rotated Sorted Array rewards precision: narrowing the search space correctly is the whole game. Interviewers love it because it reveals your boundary precision and your edge-case discipline. If you can state the invariant for your search space, you'll stop making off-by-one mistakes.

Arrays & HashingBinary Search

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Typing with Coco is free when you sign in, up to a daily limit. Talking with her out loud comes with the $79 pack. Anyone can open the editor and run their code.

1Search in Rotated Sorted Arraymedium
2Part 2
3Part 3

Each locked part opens in the editor once the part before it passes.

Based onLeetCode