public static void main(String[] args) {
        System.out.println(search(new int[]{
                1, 2, 1, 1, 1, 1, 1, 1, 1
        }, 2));
    }
Solution is easy, we first find rotated pivot index and binary search both sides of pivot.
Time complexity is Log(N);
This does not solve when there is duplicates in the array. please look at SearchinRotatedSortedArray.java
for duplicate support
src/problems/medium/SearchinRotatedSortedArray.java