mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 05:26:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>有一棵特殊的苹果树,一连 <code>n</code> 天,每天都可以长出若干个苹果。在第 <code>i</code> 天,树上会长出 <code>apples[i]</code> 个苹果,这些苹果将会在 <code>days[i]</code> 天后(也就是说,第 <code>i + days[i]</code> 天时)腐烂,变得无法食用。也可能有那么几天,树上不会长出新的苹果,此时用 <code>apples[i] == 0</code> 且 <code>days[i] == 0</code> 表示。</p>\n\n<p>你打算每天 <strong>最多</strong> 吃一个苹果来保证营养均衡。注意,你可以在这 <code>n</code> 天之后继续吃苹果。</p>\n\n<p>给你两个长度为 <code>n</code> 的整数数组 <code>days</code> 和 <code>apples</code> ,返回你可以吃掉的苹果的最大数目<em>。</em></p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>apples = [1,2,3,5,2], days = [3,2,1,4,2]\n<strong>输出:</strong>7\n<strong>解释:</strong>你可以吃掉 7 个苹果:\n- 第一天,你吃掉第一天长出来的苹果。\n- 第二天,你吃掉一个第二天长出来的苹果。\n- 第三天,你吃掉一个第二天长出来的苹果。过了这一天,第三天长出来的苹果就已经腐烂了。\n- 第四天到第七天,你吃的都是第四天长出来的苹果。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>apples = [3,0,0,0,0,2], days = [3,0,0,0,0,2]\n<strong>输出:</strong>5\n<strong>解释:</strong>你可以吃掉 5 个苹果:\n- 第一天到第三天,你吃的都是第一天长出来的苹果。\n- 第四天和第五天不吃苹果。\n- 第六天和第七天,你吃的都是第六天长出来的苹果。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>apples.length == n</code></li>\n\t<li><code>days.length == n</code></li>\n\t<li><code>1 <= n <= 2 * 10<sup>4</sup></code></li>\n\t<li><code>0 <= apples[i], days[i] <= 2 * 10<sup>4</sup></code></li>\n\t<li>只有在 <code>apples[i] = 0</code> 时,<code>days[i] = 0</code> 才成立</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 155,
|
||||
"likes": 156,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"26.1K\", \"totalSubmission\": \"57.7K\", \"totalAcceptedRaw\": 26133, \"totalSubmissionRaw\": 57683, \"acRate\": \"45.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"26.4K\", \"totalSubmission\": \"58.3K\", \"totalAcceptedRaw\": 26396, \"totalSubmissionRaw\": 58252, \"acRate\": \"45.3%\"}",
|
||||
"hints": [
|
||||
"It's optimal to finish the apples that will rot first before those that will rot last",
|
||||
"You need a structure to keep the apples sorted by their finish time"
|
||||
|
Reference in New Issue
Block a user