Pergunta de entrevista da empresa Amazon

Given an ordered circular array of integers, find an element. Meaning the array is ordered, but the lowest element is not at the first index. Example: array is [5,6,8,10,1,2,4]

Resposta da entrevista

Sigiloso

13 de set. de 2010

Binary search to find the pivot point and then binary search on the correct side of the pivot point to find the element. To find the pivot point look for an index where the next element is less than the current element instead of greater than the current element. If the current element is greater than the first element, then continue binary search to the right. If current element is less than the first element, then continue binary search to the left. Code it.

3