```
class Solution {
public:
int findMin(vector<int>& nums) {
int left = 0, right = nums.size()-1;
if(nums[left]<nums[right]) return nums[left];
while(right>left+1){
int c = (left+right)/2;
if(nums[c]>nums[left]) left = c;
else right = c;
}
return nums[right];
}
};
```