3612. Adjacent Increasing Subarrays Detection I
My accepted Python solution to LeetCode problem 3612, Adjacent Increasing Subarrays Detection I, running in 79ms.
- Difficulty: Easy
- Python
- Runtime 79ms
- Memory 17.6MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 79ms, memory 17.6MB, accepted 2025-12-31.
class Solution:
def hasIncreasingSubarrays(self, nums: List[int], k: int) -> bool:
n = len(nums)
# Check if subarray starting at i with length k is strictly increasing
def is_increasing(start, length):
for i in range(start, start + length - 1):
if nums[i] >= nums[i + 1]:
return False
return True
# Check all possible starting positions for first subarray
for a in range(n - 2 * k + 1):
b = a + k # Start of second subarray
if is_increasing(a, k) and is_increasing(b, k):
return True
return False