C++/二分法/代码:
class Solution { public: int minNumberInRotateArray(vector<int> rotateArray) { vector<int> nums = rotateArray; if(nums.size() < 0) return 0; //若数组大小为0,则返回0 int l = 0,r = nums.size()-1; while(l < r) { //二分法 int mid = l + r >> 1; //分区间(l,mid),(mid,r) if (nums[mid] < nums[0]) r = mid; else l = mid +1; } return nums[l]; } };