Skip to content

Commit c98f8e0

Browse files
committed
Create README - LeetHub
1 parent cb627b1 commit c98f8e0

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

Diff for: sliding-window-maximum/README.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<h2>239. Sliding Window Maximum</h2><h3>Hard</h3><hr><div><p>You are given an array of integers&nbsp;<code>nums</code>, there is a sliding window of size <code>k</code> which is moving from the very left of the array to the very right. You can only see the <code>k</code> numbers in the window. Each time the sliding window moves right by one position.</p>
2+
3+
<p>Return <em>the max sliding window</em>.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong>Example 1:</strong></p>
7+
8+
<pre><strong>Input:</strong> nums = [1,3,-1,-3,5,3,6,7], k = 3
9+
<strong>Output:</strong> [3,3,5,5,6,7]
10+
<strong>Explanation:</strong>
11+
Window position Max
12+
--------------- -----
13+
[1 3 -1] -3 5 3 6 7 <strong>3</strong>
14+
1 [3 -1 -3] 5 3 6 7 <strong>3</strong>
15+
1 3 [-1 -3 5] 3 6 7 <strong> 5</strong>
16+
1 3 -1 [-3 5 3] 6 7 <strong>5</strong>
17+
1 3 -1 -3 [5 3 6] 7 <strong>6</strong>
18+
1 3 -1 -3 5 [3 6 7] <strong>7</strong>
19+
</pre>
20+
21+
<p><strong>Example 2:</strong></p>
22+
23+
<pre><strong>Input:</strong> nums = [1], k = 1
24+
<strong>Output:</strong> [1]
25+
</pre>
26+
27+
<p><strong>Example 3:</strong></p>
28+
29+
<pre><strong>Input:</strong> nums = [1,-1], k = 1
30+
<strong>Output:</strong> [1,-1]
31+
</pre>
32+
33+
<p><strong>Example 4:</strong></p>
34+
35+
<pre><strong>Input:</strong> nums = [9,11], k = 2
36+
<strong>Output:</strong> [11]
37+
</pre>
38+
39+
<p><strong>Example 5:</strong></p>
40+
41+
<pre><strong>Input:</strong> nums = [4,-2], k = 2
42+
<strong>Output:</strong> [4]
43+
</pre>
44+
45+
<p>&nbsp;</p>
46+
<p><strong>Constraints:</strong></p>
47+
48+
<ul>
49+
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
50+
<li><code>-10<sup>4</sup> &lt;= nums[i] &lt;= 10<sup>4</sup></code></li>
51+
<li><code>1 &lt;= k &lt;= nums.length</code></li>
52+
</ul>
53+
</div>

0 commit comments

Comments
 (0)