Skip to content

Commit a198df6

Browse files
committed
Create README - LeetHub
1 parent 18e474e commit a198df6

File tree

1 file changed

+52
-0
lines changed
  • 3350-adjacent-increasing-subarrays-detection-ii

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<h2><a href="https://leetcode.com/problems/adjacent-increasing-subarrays-detection-ii/">3350. Adjacent Increasing Subarrays Detection II</a></h2><h3>Medium</h3><hr><div><p>Given an array <code>nums</code> of <code>n</code> integers, your task is to find the <strong>maximum</strong> value of <code>k</code> for which there exist <strong>two</strong> adjacent <span data-keyword="subarray-nonempty">subarrays</span> of length <code>k</code> each, such that both subarrays are <strong>strictly</strong> <strong>increasing</strong>. Specifically, check if there are <strong>two</strong> subarrays of length <code>k</code> starting at indices <code>a</code> and <code>b</code> (<code>a &lt; b</code>), where:</p>
2+
3+
<ul>
4+
<li>Both subarrays <code>nums[a..a + k - 1]</code> and <code>nums[b..b + k - 1]</code> are <strong>strictly increasing</strong>.</li>
5+
<li>The subarrays must be <strong>adjacent</strong>, meaning <code>b = a + k</code>.</li>
6+
</ul>
7+
8+
<p>Return the <strong>maximum</strong> <em>possible</em> value of <code>k</code>.</p>
9+
10+
<p>A <strong>subarray</strong> is a contiguous <b>non-empty</b> sequence of elements within an array.</p>
11+
12+
<p>&nbsp;</p>
13+
<p><strong class="example">Example 1:</strong></p>
14+
15+
<div class="example-block">
16+
<p><strong>Input:</strong> <span class="example-io">nums = [2,5,7,8,9,2,3,4,3,1]</span></p>
17+
18+
<p><strong>Output:</strong> <span class="example-io">3</span></p>
19+
20+
<p><strong>Explanation:</strong></p>
21+
22+
<ul>
23+
<li>The subarray starting at index 2 is <code>[7, 8, 9]</code>, which is strictly increasing.</li>
24+
<li>The subarray starting at index 5 is <code>[2, 3, 4]</code>, which is also strictly increasing.</li>
25+
<li>These two subarrays are adjacent, and 3 is the <strong>maximum</strong> possible value of <code>k</code> for which two such adjacent strictly increasing subarrays exist.</li>
26+
</ul>
27+
</div>
28+
29+
<p><strong class="example">Example 2:</strong></p>
30+
31+
<div class="example-block">
32+
<p><strong>Input:</strong> <span class="example-io">nums = [1,2,3,4,4,4,4,5,6,7]</span></p>
33+
34+
<p><strong>Output:</strong> <span class="example-io">2</span></p>
35+
36+
<p><strong>Explanation:</strong></p>
37+
38+
<ul>
39+
<li>The subarray starting at index 0 is <code>[1, 2]</code>, which is strictly increasing.</li>
40+
<li>The subarray starting at index 2 is <code>[3, 4]</code>, which is also strictly increasing.</li>
41+
<li>These two subarrays are adjacent, and 2 is the <strong>maximum</strong> possible value of <code>k</code> for which two such adjacent strictly increasing subarrays exist.</li>
42+
</ul>
43+
</div>
44+
45+
<p>&nbsp;</p>
46+
<p><strong>Constraints:</strong></p>
47+
48+
<ul>
49+
<li><code>2 &lt;= nums.length &lt;= 2 * 10<sup>5</sup></code></li>
50+
<li><code>-10<sup>9</sup> &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
51+
</ul>
52+
</div>

0 commit comments

Comments
 (0)