mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 22:13:28 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个二进制数组 <code>nums</code> , 计算其中最大连续 <code>1</code> 的个数。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,1,0,1,1,1]\n<strong>输出:</strong>3\n<strong>解释:</strong>开头的两位和最后的三位都是连续 1 ,所以最大连续 1 的个数是 3.\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<b>输入:</b>nums = [1,0,1,1,0,1]\n<b>输出:</b>2\n</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</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 306,
|
||||
"likes": 314,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Max Consecutive Ones II\", \"titleSlug\": \"max-consecutive-ones-ii\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6700\\u5927\\u8fde\\u7eed1\\u7684\\u4e2a\\u6570 II\"}, {\"title\": \"Max Consecutive Ones III\", \"titleSlug\": \"max-consecutive-ones-iii\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6700\\u5927\\u8fde\\u7eed1\\u7684\\u4e2a\\u6570 III\"}]",
|
||||
@@ -137,7 +137,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"145.5K\", \"totalSubmission\": \"238.7K\", \"totalAcceptedRaw\": 145495, \"totalSubmissionRaw\": 238674, \"acRate\": \"61.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"150.2K\", \"totalSubmission\": \"246.2K\", \"totalAcceptedRaw\": 150195, \"totalSubmissionRaw\": 246202, \"acRate\": \"61.0%\"}",
|
||||
"hints": [
|
||||
"You need to think about two things as far as any window is concerned. One is the starting point for the window. How do you detect that a new window of 1s has started? The next part is detecting the ending point for this window.\r\n\r\nHow do you detect the ending point for an existing window? If you figure these two things out, you will be able to detect the windows of consecutive ones. All that remains afterward is to find the longest such window and return the size."
|
||||
],
|
||||
|
Reference in New Issue
Block a user