标签:开始 ota 数字 describe number not bre blog 大小
class Solution { public: int minNumberInRotateArray(vector<int> rotateArray) { if(rotateArray.size()==0) return 0; int index1 = 0; int index2 = rotateArray.size()-1; int indexMid = index1; while(rotateArray[index1] >= rotateArray[index2]){ if(index2-index1 ==1){ indexMid = index2; break; } indexMid = (index1+index2)/2; if(rotateArray[indexMid] >= rotateArray[index1]) index1= indexMid; else if(rotateArray[indexMid] <= rotateArray[index2]) index2 = indexMid; } return rotateArray[indexMid]; } };
标签:开始 ota 数字 describe number not bre blog 大小
原文地址:http://www.cnblogs.com/xiuxiu55/p/6486644.html