mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-21 21:16:45 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数数组 <code>nums</code> 和一个整数 <code>k</code>。如果某个连续子数组中恰好有 <code>k</code> 个奇数数字,我们就认为这个子数组是「<strong>优美子数组</strong>」。</p>\n\n<p>请返回这个数组中 <strong>「优美子数组」</strong> 的数目。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,1,2,1,1], k = 3\n<strong>输出:</strong>2\n<strong>解释:</strong>包含 3 个奇数的子数组是 [1,1,2,1] 和 [1,2,1,1] 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [2,4,6], k = 1\n<strong>输出:</strong>0\n<strong>解释:</strong>数列中不包含任何奇数,所以不存在优美子数组。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [2,2,2,1,2,2,1,2,2,2], k = 2\n<strong>输出:</strong>16\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 50000</code></li>\n\t<li><code>1 <= nums[i] <= 10^5</code></li>\n\t<li><code>1 <= k <= nums.length</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 209,
|
||||
"likes": 210,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"39.6K\", \"totalSubmission\": \"70K\", \"totalAcceptedRaw\": 39639, \"totalSubmissionRaw\": 70040, \"acRate\": \"56.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"39.7K\", \"totalSubmission\": \"70.2K\", \"totalAcceptedRaw\": 39717, \"totalSubmissionRaw\": 70176, \"acRate\": \"56.6%\"}",
|
||||
"hints": [
|
||||
"After replacing each even by zero and every odd by one can we use prefix sum to find answer ?",
|
||||
"Can we use two pointers to count number of sub-arrays ?",
|
||||
|
Reference in New Issue
Block a user