DatasetRepo's picture
Upload folder using huggingface_hub (#1)
24e07f8 verified
{
"id": 3612,
"name": "adjacent_increasing_subarrays_detection_i",
"difficulty": "Easy",
"link": "https://leetcode.com/problems/adjacent-increasing-subarrays-detection-i/",
"date": "2024-11-03 00:00:00",
"task_description": "Given an array `nums` of `n` integers and an integer `k`, determine whether there exist **two** **adjacent** subarrays of length `k` such that both subarrays are **strictly** **increasing**. Specifically, check if there are **two** subarrays starting at indices `a` and `b` (`a < b`), where: Both subarrays `nums[a..a + k - 1]` and `nums[b..b + k - 1]` are **strictly increasing**. The subarrays must be **adjacent**, meaning `b = a + k`. Return `true` if it is _possible_ to find **two **such subarrays, and `false` otherwise. **Example 1:** **Input:** nums = [2,5,7,8,9,2,3,4,3,1], k = 3 **Output:** true **Explanation:** The subarray starting at index `2` is `[7, 8, 9]`, which is strictly increasing. The subarray starting at index `5` is `[2, 3, 4]`, which is also strictly increasing. These two subarrays are adjacent, so the result is `true`. **Example 2:** **Input:** nums = [1,2,3,4,4,4,4,5,6,7], k = 5 **Output:** false **Constraints:** `2 <= nums.length <= 100` `1 < 2 * k <= nums.length` `-1000 <= nums[i] <= 1000`",
"public_test_cases": [
{
"label": "Example 1",
"input": "nums = [2,5,7,8,9,2,3,4,3,1], k = 3",
"output": "true "
},
{
"label": "Example 2",
"input": "nums = [1,2,3,4,4,4,4,5,6,7], k = 5",
"output": "false"
}
],
"private_test_cases": [
{
"input": [
[
-669,
939,
-671,
-764,
-122,
65,
433,
-158,
532,
-539,
634,
-912,
-271,
596,
397,
732,
-474,
665,
518,
851,
3,
290,
-172,
-303,
-856,
594,
-99,
265,
-948,
-66,
381,
-217,
765,
992,
-799,
-962,
-359,
-116,
-737,
-271,
441,
552,
-845,
-663,
-415,
23,
987
],
20
],
"output": false
},
{
"input": [
[
846,
-627,
915,
-300,
-391,
-505,
507
],
2
],
"output": false
},
{
"input": [
[
871,
-896,
-232,
537,
464,
728,
-10,
-927,
-539,
-113,
928,
555,
775,
-900,
-289,
795,
-849,
450,
253,
450,
-308,
-589,
-563,
848,
119,
-780,
-381
],
5
],
"output": false
},
{
"input": [
[
0,
-807,
367,
485,
105,
174,
-444,
-479,
-440,
-626,
-645,
422,
608,
881,
-2,
147,
-796,
-752,
799,
-782,
-281,
-955,
-700,
-946,
-175,
134,
738,
-983,
441,
284,
545,
-597,
-168,
-53,
702,
-845,
-34,
126,
-351,
842,
257,
59,
821,
-974,
546,
-628,
-55,
-452,
203,
-793,
-251,
-515,
284
],
16
],
"output": false
},
{
"input": [
[
-256,
-176,
324,
-573,
-964,
-489,
-141,
884,
-44,
137,
492,
813,
-442,
608,
-455,
971,
-200,
940,
772,
359,
-886,
-454,
-148,
-473,
-344,
18,
292,
137,
-893,
238,
-706,
974,
-980,
-639,
-51,
267
],
6
],
"output": false
},
{
"input": [
[
-744,
380,
344,
139,
841,
750,
102,
-653,
-428,
-138,
104,
987,
604,
-83,
-428,
-414,
664,
-601,
663,
-907,
190,
180,
926,
-533,
-872
],
3
],
"output": false
},
{
"input": [
[
945,
-656,
548,
-31,
150,
186,
646,
-910,
998,
336,
297,
-267,
255,
748,
-171,
488,
-426,
826,
-497,
-228,
558,
-875,
606,
-372,
-83,
-63,
-639,
195,
747,
-795,
-198,
102,
187,
-546,
-325,
414,
839,
890,
959,
-581,
-662,
365,
369,
12,
-955,
-657,
-199,
56,
-141,
382,
-892,
-461,
259,
-574,
-677,
-211,
-170,
889,
-221,
462,
901,
291,
588,
863,
193,
376,
-358,
-677,
620,
-717,
782,
813,
-329,
-424,
-901
],
18
],
"output": false
},
{
"input": [
[
-344,
743,
491,
216,
42,
-955,
-472,
-736,
582,
-552,
814,
538,
35,
-988,
971,
362,
227,
-42,
709,
-704,
-529,
-537,
172,
609,
217,
-73,
-444,
67,
-820,
-687,
-158,
738,
605,
804,
-779,
463,
-677,
491,
-459,
-479,
-856,
680,
-499,
-349,
-864,
-462,
359,
119,
-916,
43,
699,
-488,
325,
559,
487,
151,
595,
425,
-785,
706,
390,
215,
-883,
-693,
446
],
3
],
"output": true
},
{
"input": [
[
-996,
361,
-258,
-631,
-979,
897,
-327,
-292,
337,
-78,
-520,
219,
-781,
543,
337,
-380,
-594,
890,
364,
384,
-513,
144,
-925,
315,
273,
363,
-984,
170,
-841,
-78,
-801,
892,
-630,
193,
212,
157,
403,
238,
-718,
-641,
944,
219,
-227,
-986,
-432,
165,
629,
-137,
-696,
865,
776,
117,
890,
627,
-135,
667,
-507,
-103,
34,
455,
-905,
-773,
90,
-340,
-606,
-129,
-215,
437,
-61,
308,
-264,
306,
-253,
-399,
-677,
912,
-274,
71
],
15
],
"output": false
},
{
"input": [
[
188,
642,
-770,
-52,
-48,
858,
-237,
449,
-619,
40,
-469,
852,
836,
40,
-944,
-275,
69,
-951,
-455,
822,
-255,
417,
-139,
-546,
-978,
200,
378,
545,
306,
710,
617,
585,
-653,
463,
474,
732,
98,
541,
-47,
-23,
-550,
-972,
-50,
361,
675,
-365,
673,
-866,
-522,
-879,
752,
-893,
-458,
-673,
774,
-721,
498,
-212,
801,
654,
886,
-257,
489,
-367,
-57,
-155,
-139,
-693,
875,
299,
-426,
-566,
250,
-121,
677,
-65,
523,
439,
119,
407,
-715,
915,
674
],
38
],
"output": false
}
],
"haskell_template": "hasIncreasingSubarrays :: [Int] -> Int -> Bool\nhasIncreasingSubarrays nums k ",
"ocaml_template": "let hasIncreasingSubarrays (nums: int list) (k: int) : bool = ",
"scala_template": "def hasIncreasingSubarrays(nums: List[Int],k: Int): Boolean = { \n \n}",
"java_template": "class Solution {\n public boolean hasIncreasingSubarrays(List<Integer> nums, int k) {\n \n }\n}",
"python_template": "class Solution(object):\n def hasIncreasingSubarrays(self, nums, k):\n \"\"\"\n :type nums: List[int]\n :type k: int\n :rtype: bool\n \"\"\"\n "
}