you should note that the condition that "all elements are unique " is important, otherwise you would have a situation like [ 0 1 -1 0 0 0 0 ], which could be considered a rotation of [ -1 0 0 0 0 0 1 ]. in this case if you just compare A[low] and A[mid] ( or, A[0] and A[3] ), the situation would be the same with [ 0 0 0 0 1 -1 0 ], which is also a legal rotation. but for example if u search for 1 in both cases, you should get different answers, but just comparing A[low], A[high], A[mid] would lead to completely the same answers, causing a mistake (at least when we are limited to log(N) algorithms, i.e. in fact to distinguish the above 2 situations you would have to resort to a linear scan of the input )

btw here is my accepted solution

```
public class Solution {
public int search(int[] A, int target) {
int low = 0; int high = A.length-1;
while(low <=high) {
int mid = (low+high )/2;
if (A[mid] == target) return mid;
if (A[low] < A[mid] && A[low] <= target && target < A[mid] || A[low] > A[mid] && (target < A[mid] || target >= A[low]))
high = mid -1;
else
low = mid +1;
}
return -1;
}
```

}