We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8d02073 commit 7f106bbCopy full SHA for 7f106bb
2018.12.24-leetcode665/Tony the Cyclist.md
@@ -0,0 +1,36 @@
1
+```java
2
+class Solution {
3
+ public boolean checkPossibility(int[] nums) {
4
+ if(nums.length < 2){
5
+ return true;
6
+ }
7
+ int cot = 0;
8
+ int index;
9
+ if(nums[0] > nums[1]){
10
+ cot = 1;
11
12
+ int len = nums.length - 1;
13
+ for (int i = 1; i < len; i ++){
14
+ if (cot > 1){
15
+ return false;
16
17
+ if (nums[i] > nums[i+1]){
18
+ if(nums[i-1] >= nums[i+1]){
19
+ nums[i+1] = nums[i];
20
+
21
22
+ else {
23
+ nums[i] = nums[i-1];
24
25
+ //len--;
26
+ //i--;
27
+ cot++;
28
29
30
31
32
33
34
35
+}
36
+```
0 commit comments