题解 | #旋转数组的最小数字#
旋转数组的最小数字
https://www.nowcoder.com/practice/9f3231a991af4f55b95579b44b7a01ba
class Solution { public: int minNumberInRotateArray(vector<int>& nums) { int start=0; int end=nums.size()-1; int mid=(start+end)/2; while(start<end) { //int mid=(start+end)/2; if(nums[mid]<nums[end]) end=mid; else if(nums[mid]==nums[end]) { end--; } else start=mid+1; mid=(start+end)/2; } return nums[mid]; } };