mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-24 22:38:57 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个二进制数组 <code>nums</code> 和一个整数 <code>k</code>,如果可以翻转最多 <code>k</code> 个 <code>0</code> ,则返回 <em>数组中连续 <code>1</code> 的最大个数</em> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,1,1,0,0,0,1,1,1,1,0], K = 2\n<strong>输出:</strong>6\n<strong>解释:</strong>[1,1,1,0,0,<strong>1</strong>,1,1,1,1,<strong>1</strong>]\n粗体数字从 0 翻转到 1,最长的子数组长度为 6。</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [0,0,1,1,0,0,1,1,1,0,1,1,0,0,0,1,1,1,1], K = 3\n<strong>输出:</strong>10\n<strong>解释:</strong>[0,0,1,1,<strong>1</strong>,<strong>1</strong>,1,1,1,<strong>1</strong>,1,1,0,0,0,1,1,1,1]\n粗体数字从 0 翻转到 1,最长的子数组长度为 10。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>\n\t<li><code>nums[i]</code> 不是 <code>0</code> 就是 <code>1</code></li>\n\t<li><code>0 <= k <= nums.length</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 392,
|
||||
"likes": 410,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Longest Substring with At Most K Distinct Characters\", \"titleSlug\": \"longest-substring-with-at-most-k-distinct-characters\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u81f3\\u591a\\u5305\\u542b K \\u4e2a\\u4e0d\\u540c\\u5b57\\u7b26\\u7684\\u6700\\u957f\\u5b50\\u4e32\"}, {\"title\": \"Longest Repeating Character Replacement\", \"titleSlug\": \"longest-repeating-character-replacement\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u66ff\\u6362\\u540e\\u7684\\u6700\\u957f\\u91cd\\u590d\\u5b57\\u7b26\"}, {\"title\": \"Max Consecutive Ones\", \"titleSlug\": \"max-consecutive-ones\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u6700\\u5927\\u8fde\\u7eed 1 \\u7684\\u4e2a\\u6570\"}, {\"title\": \"Max Consecutive Ones II\", \"titleSlug\": \"max-consecutive-ones-ii\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6700\\u5927\\u8fde\\u7eed1\\u7684\\u4e2a\\u6570 II\"}]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"81.4K\", \"totalSubmission\": \"136.3K\", \"totalAcceptedRaw\": 81448, \"totalSubmissionRaw\": 136296, \"acRate\": \"59.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"86.6K\", \"totalSubmission\": \"144.3K\", \"totalAcceptedRaw\": 86560, \"totalSubmissionRaw\": 144318, \"acRate\": \"60.0%\"}",
|
||||
"hints": [
|
||||
"One thing's for sure, we will only flip a zero if it extends an existing window of 1s. Otherwise, there's no point in doing it, right? Think Sliding Window!",
|
||||
"Since we know this problem can be solved using the sliding window construct, we might as well focus in that direction for hints. Basically, in a given window, we can never have > K zeros, right?",
|
||||
|
||||
Reference in New Issue
Block a user