import java.util.ArrayList;
public class Solution {
    public int minNumberInRotateArray(int [] nums) {
        int l = 0, r = nums.length - 1;
        while(l < r){
            int mid = l + ((r - l)>>1);
            if(nums[mid] == nums[r]){
                r--;
            }else if(nums[mid] < nums[r]){
                r = mid;
            }else {
                l = mid + 1;
            }
        }
        return nums[l];
    }
}