Skip to content

Commit cf4b10d

Browse files
committed
Time: 0 ms (100.00%) | Memory: 39.9 MB (81.89%) - LeetSync
1 parent f7977ba commit cf4b10d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Solution {
2+
public boolean check(int[] nums) {
3+
int count = 0;
4+
5+
for(int i = 0; i < nums.length-1; i++){
6+
if(nums[i] > nums[i+1])
7+
count++;
8+
}
9+
10+
if(count == 0)
11+
return true;
12+
else if(count > 1)
13+
return false;
14+
else if(nums[0] >= nums[nums.length-1])
15+
return true;
16+
else
17+
return false;
18+
}
19+
}

0 commit comments

Comments
 (0)