class Solution {
public:
bool isMonotonic(vector<int>& A) {
vector<int> B = A;
vector<int> C = A;
sort(B.begin(), B.end());
sort(C.begin(), C.end(), greater<int>());
if(A == B || A == C)
{
return true;
}
return false;
}
};
leetcode 896. 单调数列
最新推荐文章于 2021-02-28 09:32:34 发布