1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/滑动窗口的最大值 [hua-dong-chuang-kou-de-zui-da-zhi-lcof].html
2022-03-29 12:43:11 +08:00

25 lines
1003 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给定一个数组 <code>nums</code> 和滑动窗口的大小 <code>k</code>,请找出所有滑动窗口里的最大值。</p>
<p><strong>示例:</strong></p>
<pre><strong>输入:</strong> <em>nums</em> = <code>[1,3,-1,-3,5,3,6,7]</code>, 和 <em>k</em> = 3
<strong>输出: </strong><code>[3,3,5,5,6,7]
<strong>解释:
</strong></code>
滑动窗口的位置 最大值
--------------- -----
[1 3 -1] -3 5 3 6 7 3
1 [3 -1 -3] 5 3 6 7 3
1 3 [-1 -3 5] 3 6 7 5
1 3 -1 [-3 5 3] 6 7 5
1 3 -1 -3 [5 3 6] 7 6
1 3 -1 -3 5 [3 6 7] 7</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<p>你可以假设 <em>k </em>总是有效的在输入数组不为空的情况下1 &le; k &le;&nbsp;输入数组的大小。</p>
<p>注意:本题与主站 239 题相同:<a href="https://leetcode-cn.com/problems/sliding-window-maximum/">https://leetcode-cn.com/problems/sliding-window-maximum/</a></p>