public class Solution {
public int minNumberInRotateArray(int [] array) {
//直接找到最小值 for循环遍历
//或者二分法
if(array == null ||array.length == 0){
return -1;
}
int left = 0;
int right = array.length - 1;
while(left <right){
//在最左边了都
if(array[left] < array[right]){
return array[left];
}
int mid = (right - left) /2 +left;
if(array[mid] >array[right]){
left = mid +1;
}else if( array[mid] < array[right]){
right = mid;
}else{
right --;
}
}
return array[left];
}
}