Interview Question
Country: United States
Great answer. I think you might want this, though.
new_index = (index + O.len() - pivot_index) % O.len()
Which company? Phone? Onsite?
O(1) is impossible for finding element in sorted array. So your question is complete nonsense.
(second part might be interesting though, but not as an interview question).
In the problem description he said suppose that you have a find function that finds the value in O(1). So using that function you have to implement your own function. Makes sense to me.
- rotinom April 10, 2014