Search a Rotated List
Talk it through out loud with your AI coach.
The problem
- medium
- Pro
A sorted list of distinct numbers has been rotated at an unknown point, so it might look like four, five, six, seven, zero, one, two. Find a target's position in logarithmic time, or return minus one. Explain how binary search still works.
What a strong answer covers
- A property that still holds at every midpoint of a rotated list.
- How to tell which half is in order.
- Deciding which half could contain the target.
- The cost and small or unrotated lists.
Common mistake: Finding the rotation point first and then searching, without seeing that one search can do it.
Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.
Practise it out loud