```
int findMin(vector<int> &num) {
if(num.size() == 1) return num[0];
int l = 0, r = num.size()-1;
while(l+1<r){
int m = (l+r)/2;
if(num[l] == num[r])
l++;
else if(num[l]<num[r])
return num[l];
else{
if(num[m]>=num[l])
l = m;
else
r = m;
}
}
return num[l]<num[r]?num[l]:num[r];
```

}