二分
class Solution { public: int minNumberInRotateArray(vector<int> nums) { int n = nums.size(); if(n == 0) return 0; int left = 0, right = n - 1; int res = INT_MAX; while(left < right){ int mid = left + (right - left) / 2; if(nums[left] == nums[mid]){ res = min(res, nums[left]); left ++; continue; } if(nums[mid] > nums[left]){ res = min(res, nums[left]); left = mid + 1; }else{ right = mid; } } res = min(res, nums[left]); return res; } };