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 2dc3c96 commit 154527eCopy full SHA for 154527e
3349-adjacent-increasing-subarrays-detection-i.js
@@ -0,0 +1,33 @@
1
+/**
2
+ * @param {number[]} nums
3
+ * @param {number} k
4
+ * @return {boolean}
5
+ */
6
+var hasIncreasingSubarrays = function (nums, k) {
7
+ const n = nums.length
8
+
9
+ for (let i = 0; i <= n - 2 * k; ++i) {
10
+ let firstIncreasing = true
11
+ let secondIncreasing = true
12
13
+ for (let j = i; j < i + k - 1; ++j) {
14
+ if (nums[j] >= nums[j + 1]) {
15
+ firstIncreasing = false
16
+ break
17
+ }
18
19
20
+ if (!firstIncreasing) continue
21
22
+ for (let j = i + k; j < i + 2 * k - 1; ++j) {
23
24
+ secondIncreasing = false
25
26
27
28
29
+ if (firstIncreasing && secondIncreasing) return true
30
31
32
+ return false
33
+}
0 commit comments