Skip to content

Commit 145132c

Browse files
authored
Create 3349.js
1 parent 4facff3 commit 145132c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

3001-3500/3349.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var hasIncreasingSubarrays = function(nums, k) {
2+
let inc = 1, prevInc = 0, maxLen = 0;
3+
for (let i = 1; i < nums.length; i++) {
4+
if (nums[i] > nums[i - 1]) inc++;
5+
else {
6+
prevInc = inc;
7+
inc = 1;
8+
}
9+
maxLen = Math.max(maxLen, Math.max(inc >> 1, Math.min(prevInc, inc)));
10+
if (maxLen >= k) return true;
11+
}
12+
return false;
13+
};

0 commit comments

Comments
 (0)