class Solution {
public:
int minArray(vector<int>& numbers) {
int i=0,j=numbers.size()-1;
while(i<j){ //当 i=j 时跳出二分循环,并返回旋转点的值 nums[i]即可
int m=(i+j)/2; // i<=m<j
if(numbers[m]<numbers[j]) j=m; //旋转点x在[i,m]
else if(numbers[m]>numbers[j]) i=m+1; //旋转点x在[m+1,j]
else --j; //不能确定在左或右,缩小二分范围
}
return numbers[i];
}
};
08-07
3149
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)