#3349
Adjacent Increasing Subarrays Detection I
pupil · 460 · lc easy +26 · 48% accepted · 481 likes · top 33%
Description
Given an array nums of n integers and a positive integer k, determine whether there exist two adjacent subarrays of length k, both strictly increasing, starting at consecutive positions a and b (where b = a + k):
- Both nums[a..a + k - 1] and nums[b..b + k - 1] are strictly increasing.
- The subarrays are adjacent, meaning b = a + k.
Return true if such a pair exists, and false otherwise.
Code
1
2
3