@@ -0,0 +1,991 @@
+// Suppose a sorted array is rotated at some pivot unknown to you beforehand.%0A%0A// (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).%0A%0A// You are given a target value to search. If found in the array return its index, otherwise return -1.%0A%0A// You may assume no duplicate exists in the array.%0A%0Apublic class Solution %7B%0A    public int search(int%5B%5D A, int target) %7B%0A    %09int len = A.length;%0A%0A    %09if(len == 0) return -1;%0A%0A    %09int start = 0;%0A    %09int end = len - 1;%0A%0A    %09while(start %3C= end)%7B%0A    %09%09int mid = (start + end) / 2;%0A%0A    %09%09if(A%5Bmid%5D == target)%7B%0A    %09%09%09return mid;%0A    %09%09%7Delse if(A%5Bmid%5D %3C A%5Bend%5D)%7B%0A    %09%09%09// right half is sorted.%0A    %09%09%09if(A%5Bmid%5D %3C target && A%5Bend%5D %3E= target)%7B%0A    %09%09%09%09start = mid + 1;%0A    %09%09%09%7Delse%7B%0A    %09%09%09%09end = mid - 1;%0A    %09%09%09%7D%0A    %09%09%7Delse %7B%0A    %09%09//if(A%5Bmid%5D %3E A%5Bstart%5D)%7B%0A    %09%09%09// left half is sorted.%0A    %09%09%09if(A%5Bmid%5D %3E target && A%5Bstart%5D %3C= target)%7B%0A    %09%09%09%09end = mid - 1;%0A    %09%09%09%7Delse%7B%0A    %09%09%09%09start = mid + 1;%0A    %09%09%09%7D%0A    %09%09%7D%0A    %09%7D%0A%0A    %09return -1;%0A    %7D%0A%7D%0A

add search in rotated sorted array solution