#3350
Adjacent Increasing Subarrays Detection II
specialist · 735 · lc medium +31 · 58.9% accepted · 488 likes · top 56%
Description
Given an array nums of n integers, find the largest k for which two adjacent subarrays of length k, both strictly increasing, exist. More precisely, find the maximum k such that there are indices a and b where b = a + k and both subarrays nums[a..a + k - 1] and nums[b..b + k - 1] are strictly increasing.
Return the maximum possible value of k.
A subarray is a contiguous non-empty sequence of elements within an array.
Code
1
2
3