class Solution {
public:
int minArray(vector<int>& numbers) {
int low = 0,high = numbers.size()-1;
while(low<high)
{
int mid = low + (high-low)/2;
if(numbers[mid]<numbers[high]) high = mid;
else if(numbers[mid]>numbers[high])low = mid+1;
else high--;
}
return numbers[low];
}
};
剑指 Offer 11. 旋转数组的最小数字
最新推荐文章于 2022-10-08 22:26:59 发布