Repeats make binary search linear.
transcript
Binary search on a rotated list. Add repeated values. The worst case becomes linear.
One, one, one, zero, one. It is a valid rotation of zero, one, one, one, one. The last id is one. Every id is at most one. The test says: no first run.
The smallest id is zero. It sits in slot three. The test could not see it.
A list of ones, and one zero. The zero can sit in any slot. You cannot skip a slot safely. Any slot you skip could hold the zero.
There is a fix: drop the tail that equals the first id. Then search as before. But it can drop almost every id.
A hundred thousand ids. One zero, in slot one. The fix drops almost every id. In the worst case, every slot must be read.
Say it out loud in an interview. With few repeats, it stays fast. Be honest about the worst case. Full breakdown in the lecture.