这是简单题嘛,好难呜呜呜~~~~~~,二分查找的变种,规划end(最后的下标)与mid(中间的下标)

import java.util.ArrayList;
public class Solution {
    public int minNumberInRotateArray(int [] array) {
        int mid = array.length / 2;
        int first = 0;
        int end = array.length-1;
        int w = 0;
        while(first < end){
            if((end - first) == 1){
               
                break;
            }
            if(array[end] > array[mid]){
                end=mid;
                mid = (end+first) / 2;
            }
            else if(array[end] < array[mid]){
                first = mid+1;  //最小的不会是mid,还有end小
                mid = (end+first) / 2;
            }
            else if(array[end] == array[mid]){
                end--;
                mid = (end+first) / 2;
               
            }
            
            
            
        }
        if(array[first] > array[end]){
            return array[end];
        }
        else{
            return array[first];
        }
    }
}