You are given a sorted array [containing no repeated elements] of size N, on which left circular rotation has been applied k number of times.
For example, left circular rotation of 1, 2, 3, 4, 5, 6 will give 2, 3, 4, 5,6 , 1
One more left circular rotation will give 3, 4, 5, 6, 1, 2 and so on.
The algorithm for finding the value of k should use O(1) space and should take a maximum of O(log2N) time.
This is the c++ forum. The code you have above isn't c++, it looks like you should try posting it on the natural language forum.
Topic archived. No new replies allowed.