class Solution {
public:
    int minNumberInRotateArray(vector<int> rotateArray) {
        int len = rotateArray.size();
        if (len == 1) {
            return rotateArray[0];
        }
        int left = 0, right = len - 1;
        int mid;
        while (left < right) {
            if (rotateArray[left] < rotateArray[right]) {
                return rotateArray[left];
            }
            mid = (left + right) / 2;
            // 说明最小值在右面
            if (rotateArray[left] < rotateArray[mid]) {
                left = mid + 1;
            } else if (rotateArray[mid] < rotateArray[right]) {
                right = mid;
            } else {
                left++;
            }
        }
        return rotateArray[left];
        
    }
};