3349. Adjacent Increasing Subarrays Detection I Easy

@problem@discussion
#Array



1/**
2 * [3349] Adjacent Increasing Subarrays Detection I
3 *
4 * Given an array nums of n integers and an integer k, determine whether there exist two adjacent <span data-keyword="subarray-nonempty">subarrays</span> 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:
5 * 
6 * 	Both subarrays nums[a..a + k - 1] and nums[b..b + k - 1] are strictly increasing.
7 * 	The subarrays must be adjacent, meaning b = a + k.
8 * 
9 * Return true if it is possible to find two such subarrays, and false otherwise.
10 *  
11 * <strong class="example">Example 1:
12 * <div class="example-block">
13 * Input: <span class="example-io">nums = [2,5,7,8,9,2,3,4,3,1], k = 3</span>
14 * Output: <span class="example-io">true</span>
15 * Explanation:
16 * 
17 * 	The subarray starting at index 2 is [7, 8, 9], which is strictly increasing.
18 * 	The subarray starting at index 5 is [2, 3, 4], which is also strictly increasing.
19 * 	These two subarrays are adjacent, so the result is true.
20 * </div>
21 * <strong class="example">Example 2:
22 * <div class="example-block">
23 * Input: <span class="example-io">nums = [1,2,3,4,4,4,4,5,6,7], k = 5</span>
24 * Output: <span class="example-io">false</span>
25 * </div>
26 *  
27 * Constraints:
28 * 
29 * 	2 <= nums.length <= 100
30 * 	1 < 2 * k <= nums.length
31 * 	-1000 <= nums[i] <= 1000
32 * 
33 */
34pub struct Solution {}
35
36// problem: https://leetcode.com/problems/adjacent-increasing-subarrays-detection-i/
37// discuss: https://leetcode.com/problems/adjacent-increasing-subarrays-detection-i/discuss/?currentPage=1&orderBy=most_votes&query=
38
39// submission codes start here
40
41impl Solution {
42    pub fn has_increasing_subarrays(nums: Vec<i32>, k: i32) -> bool {
43        false
44    }
45}
46
47// submission codes end
48
49#[cfg(test)]
50mod tests {
51    use super::*;
52
53    #[test]
54    fn test_3349() {
55    }
56}
57


Back
© 2025 bowen.ge All Rights Reserved.