题目描述:
代码如下:
class Solution {
public int minArray(int[] numbers) {
int left=0;
int right=numbers.length-1;
while (left<right){//注意细节
int mid=left+(right-left)/2;
if(numbers[mid]>numbers[right]){
left=mid+1;
}else if(numbers[mid]<numbers[right]){
right=mid;//注意细节
}else {
right--;//防止重复的数字影响判断
}
}
return numbers[left];
}
}