Complete-Preparation

🎉 One-stop destination for all your technical interview Preparation 🎉

View the Project on GitHub

Find Element in Rotated array

Code

int findInRotated(vector<int>& a)
{
    int n = a.size();
    int minElemIndex = numberOfTimesRotated(a);
    // binarySearch(array, StartIndex, EndIndex);
    return max(binarySearch(a, 0, minElemIndex), binarySearch(a, minElemIndex, n - 1));
}