牛客-旋轉數組的最小值

牛客-旋轉數組的最小值

#include <stdio.h>
#include <queue>
#include <stack>
#include <math.h>
#include <map>
#include <string.h>
#include <string>
#include <cstring>
#include <set>
#include <algorithm>
#include <vector>
using namespace std;



class Solution {
public:
    int minNumberInRotateArray(vector<int> rotateArray) {
        if (rotateArray.size() == 0) {
            return 0;
        }
        int min = rotateArray[0];
        for (int i=0; i<rotateArray.size(); i++) {
            if (rotateArray[i]<min) {
                return rotateArray[i];
            }
        }
        
        return 0;
    }
};

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章