**Problem** : Find the count k by which array has been rotated in the rotated sorted array.

So for example we have sorted array as

2,3,6,12, 15, 18.

Now suppose the array is rotated k times ( we don’t know k), such that array becomes

15, 18,2,3,6,12

We have to find K?

**Solution** :

This can be solved in logarithmic time. If we notice the above array, we see the array has been rotated 2 times, which is also the index of smallest element in the array.

So, we need to find the point of inflection where we find a point such that a[i]>a[i+1].

So, finding the minimum element in the rotated sorted array has been explained in our previous post - Find the minimum element in rotated sorted array.

as the array is sorted we can also check the occurance of the first element also .Number of times the first element is encountered till the array is completed is the rotation count