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