Determine whether an array contains two adjacent strictly increasing subarrays of a given length.
Given an integer array nums and an integer k, determine whether there exist two adjacent subarrays of length k such that:
In other words, you are looking for a contiguous segment of length 2k where both halves of length k are strictly increasing.
Return true if such a pair exists, otherwise return false.
nums.k.nums: integer arrayk: positive integertrue if there are two adjacent strictly increasing subarrays of length k; otherwise return false.1 <= k <= nums.length / 2nums contains integers2kExample 1
Input
nums = [1,2,3,1,2,3], k = 3
Output
true
Explanation
The subarray [1,2,3] is strictly increasing, and the adjacent subarray [1,2,3] is also strictly increasing.
Example 2
Input
nums = [1,2,1,2,3], k = 2
Output
true
Explanation
The subarrays [1,2] and [1,2] at positions [0..1] and [2..3] are adjacent and both strictly increasing.
Example 3
Input
nums = [5,4,3,2,1], k = 2
Output
false
Explanation
There is no pair of adjacent subarrays of length 2 that are both strictly increasing.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.