class Solution { public: int minNumberInRotateArray(vector<int> rotateArray) { int i = floor(rotateArray.size() / 2); int j = ceil(rotateArray.size() / 2); while (i > 0 && j < rotateArray.size()) { if (rotateArray[i - 1] <= rotateArray[i]) i--; else return rotateArray[i]; if (rotateArray[j] <= rotateArray[j + 1]) j++; else return rotateArray[j + 1]; } if(i == 0) return rotateArray[0]; return rotateArray[rotateArray.size()-1]; } };