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