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