import java.util.ArrayList;
public class Solution {
    public int minNumberInRotateArray(int [] arr) {
        if (arr == null || arr.length < 1) {
            return 0;
        }
        int n = arr.length;
        int left = 0;
        int right = n - 1;
        while (left < right) {
            int mid = left + (right - left) / 2;
            if (arr[mid] > arr[right]) {
                left = mid + 1;
            } else if (arr[mid] < arr[right]) {
                right = mid;
            } else {
                right--;
            }
        }
        return arr[left];
    }
}