- Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy path_3349.java
39 lines (37 loc) · 1.24 KB
/
_3349.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
packagecom.fishercoder.solutions.fourththousand;
importjava.util.List;
publicclass_3349 {
publicstaticclassSolution1 {
publicbooleanhasIncreasingSubarrays(List<Integer> nums, intk) {
for (inti = 0; i < nums.size(); i++) {
intcount = 1;
intj = i;
booleanpossible = true;
for (; j + 1 < nums.size() && count++ < k; j++) {
if (nums.get(j + 1) <= nums.get(j)) {
possible = false;
break;
}
}
booleanpossibleAgain = true;
j++;
if (possible) {
count = 1;
for (; j + 1 < nums.size() && count++ < k; j++) {
if (nums.get(j + 1) <= nums.get(j)) {
possibleAgain = false;
break;
}
}
if (count < k) {
possibleAgain = false;
}
if (possibleAgain) {
returntrue;
}
}
}
returnfalse;
}
}
}