int minNumberInRotateArray(int* nums, int numsLen) { // write code here int left = 0; int right = numsLen - 1; int mid = 0; while (left < right) { mid = left + (right - left) / 2; if (nums[mid] >= nums[mid - 1] && nums[mid] <= nums[mid + 1]) { if (nums[mid] <= nums[right]) { right = mid; } else { left = mid; } } else { if (nums[mid] >= nums[mid - 1] && nums[mid] >= nums[mid + 1]) return nums[mid + 1]; else return nums[mid]; } } return nums[mid]; }