Skip to content

Commit a021082

Browse files
committed
Time: 7 ms (18.93%), Space: 8.4 MB (38.73%) - LeetHub
1 parent f27c2f2 commit a021082

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public:
3+
bool check(vector<int>& nums) {
4+
int cnt = 0;
5+
for(int i=1;i<nums.size();i++)
6+
{
7+
if(nums[i] < nums[i-1])
8+
cnt++;
9+
}
10+
if(nums[nums.size()-1] > nums[0])
11+
cnt++;
12+
13+
return cnt<=1;
14+
}
15+
};

0 commit comments

Comments
 (0)