class Solution {
public:
int search(vector<int>& nums, int target) {
int l=0,r=nums.size();
while(l<r){
int m=l+r>>1;
if(target==nums[m]) return m;
if(nums[m]<nums[r-1]){
if(m+1<nums.size()&&nums[m+1]<=target&&target<=nums[r-1]) l=m+1;
else r=m;
}
else{
if(nums[l]<=target&&m&&target<=nums[m-1]) r=m;
else l=m+1;
}
}
return -1;
}
};
11-02
11-02