```
int findMin(vector<int>& nums) {
int l = 0, r = nums.size()-1,ans=nums[0];
while(l <= r){
int mid = l + ((r - l)>>1);
if(nums[mid] >= nums[r]) l = mid+1;
else r = mid-1;
if(ans > nums[mid]) ans = nums[mid];
}
return ans;
}
```