1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 07:21:40 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个整数数组 <code>nums</code>,有一个大小为&nbsp;<code>k</code><em>&nbsp;</em>的滑动窗口从数组的最左侧移动到数组的最右侧。你只可以看到在滑动窗口内的 <code>k</code>&nbsp;个数字。滑动窗口每次只向右移动一位。</p>\n\n<p>返回 <em>滑动窗口中的最大值 </em>。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<b>输入:</b>nums = [1,3,-1,-3,5,3,6,7], k = 3\n<b>输出:</b>[3,3,5,5,6,7]\n<b>解释:</b>\n滑动窗口的位置 最大值\n--------------- -----\n[1 3 -1] -3 5 3 6 7 <strong>3</strong>\n 1 [3 -1 -3] 5 3 6 7 <strong>3</strong>\n 1 3 [-1 -3 5] 3 6 7 <strong> 5</strong>\n 1 3 -1 [-3 5 3] 6 7 <strong>5</strong>\n 1 3 -1 -3 [5 3 6] 7 <strong>6</strong>\n 1 3 -1 -3 5 [3 6 7] <strong>7</strong>\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<b>输入:</b>nums = [1], k = 1\n<b>输出:</b>[1]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><b>提示:</b></p>\n\n<ul>\n\t<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>-10<sup>4</sup>&nbsp;&lt;= nums[i] &lt;= 10<sup>4</sup></code></li>\n\t<li><code>1 &lt;= k &lt;= nums.length</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 1504,
"likes": 1573,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Minimum Window Substring\", \"titleSlug\": \"minimum-window-substring\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u6700\\u5c0f\\u8986\\u76d6\\u5b50\\u4e32\"}, {\"title\": \"Min Stack\", \"titleSlug\": \"min-stack\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u6700\\u5c0f\\u6808\"}, {\"title\": \"Longest Substring with At Most Two Distinct Characters\", \"titleSlug\": \"longest-substring-with-at-most-two-distinct-characters\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u81f3\\u591a\\u5305\\u542b\\u4e24\\u4e2a\\u4e0d\\u540c\\u5b57\\u7b26\\u7684\\u6700\\u957f\\u5b50\\u4e32\"}, {\"title\": \"Paint House II\", \"titleSlug\": \"paint-house-ii\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u7c89\\u5237\\u623f\\u5b50 II\"}]",
@@ -161,7 +161,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"264.2K\", \"totalSubmission\": \"530K\", \"totalAcceptedRaw\": 264194, \"totalSubmissionRaw\": 530038, \"acRate\": \"49.8%\"}",
"stats": "{\"totalAccepted\": \"279.7K\", \"totalSubmission\": \"561.4K\", \"totalAcceptedRaw\": 279734, \"totalSubmissionRaw\": 561402, \"acRate\": \"49.8%\"}",
"hints": [
"How about using a data structure such as deque (double-ended queue)?",
"The queue size need not be the same as the windows size.",