本文轉載自:http://www.javaxxz.com/thread-359218-1-1.html
劍指offer——面試題8:旋轉數組的最小數字
哈哈哈,弱智題,一遍過
class Solution {
public:
int minNumberInRotateArray(vector<int> rotateArray) {
int n=rotateArray.size();
if(n<=1) return n==0? 0:rotateArray[0];
for(int i=1;i<n;i++){
if(rotateArray[i]<rotateArray[i-1])
return rotateArray[i];
}
return rotateArray[0];
}
};