educative.io

Challenge 2: Search in a Rotated List - Algorithms for Coding Interviews in

In the search in rotated list problem, it seems that the solution assumes the list is pivoted only once, but the problem spec says the list ‘has been rotated an unknown number of times’. Is this a typo?

In the binary search problem, we assume that the list is sorted. In pivoted binary search, we assume that the list is rotated a multiple number of times so it does not remain sorted.

Anum Hassan | Developer Advocate
educative.io

Thank you for your reply. Really appreciate it. But it seems that the solution only deals with cases where the list is rotated only ONCE, but not multiple times. Did I miss something?

The sorted list is [0, 3, 5, 6, 7, 8, 9]. If this list is rotated thrice, we get an unsorted list as mentioned in the question:

7, 8, 9, 0, 3, 5, 6

I hope this answers your question.
Anum Hassan | Developer Advocate
Educative.io