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>n</code> 枚花的种子。每枚种子必须先种下,才能开始生长、开花。播种需要时间,种子的生长也是如此。给你两个下标从 <strong>0</strong> 开始的整数数组 <code>plantTime</code> 和 <code>growTime</code> ,每个数组的长度都是 <code>n</code> :</p>\n\n<ul>\n\t<li><code>plantTime[i]</code> 是 <strong>播种</strong> 第 <code>i</code> 枚种子所需的 <strong>完整天数</strong> 。每天,你只能为播种某一枚种子而劳作。<strong>无须</strong> 连续几天都在种同一枚种子,但是种子播种必须在你工作的天数达到 <code>plantTime[i]</code> 之后才算完成。</li>\n\t<li><code>growTime[i]</code> 是第 <code>i</code> 枚种子完全种下后生长所需的 <strong>完整天数 </strong>。在它生长的最后一天 <strong>之后</strong> ,将会开花并且永远 <strong>绽放</strong> 。</li>\n</ul>\n\n<p>从第 <code>0</code> 开始,你可以按 <strong>任意</strong> 顺序播种种子。</p>\n\n<p>返回所有种子都开花的 <strong>最早</strong> 一天是第几天。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/12/21/1.png\" style=\"width: 453px; height: 149px;\">\n<pre><strong>输入:</strong>plantTime = [1,4,3], growTime = [2,3,1]\n<strong>输出:</strong>9\n<strong>解释:</strong>灰色的花盆表示播种的日子,彩色的花盆表示生长的日子,花朵表示开花的日子。\n一种最优方案是:\n第 0 天,播种第 0 枚种子,种子生长 2 整天。并在第 3 天开花。\n第 1、2、3、4 天,播种第 1 枚种子。种子生长 3 整天,并在第 8 天开花。\n第 5、6、7 天,播种第 2 枚种子。种子生长 1 整天,并在第 9 天开花。\n因此,在第 9 天,所有种子都开花。 \n</pre>\n\n<p><strong>示例 2:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/12/21/2.png\" style=\"width: 454px; height: 184px;\">\n<pre><strong>输入:</strong>plantTime = [1,2,3,2], growTime = [2,1,2,1]\n<strong>输出:</strong>9\n<strong>解释:</strong>灰色的花盆表示播种的日子,彩色的花盆表示生长的日子,花朵表示开花的日子。 \n一种最优方案是:\n第 1 天,播种第 0 枚种子,种子生长 2 整天。并在第 4 天开花。\n第 0、3 天,播种第 1 枚种子。种子生长 1 整天,并在第 5 天开花。\n第 2、4、5 天,播种第 2 枚种子。种子生长 2 整天,并在第 8 天开花。\n第 6、7 天,播种第 3 枚种子。种子生长 1 整天,并在第 9 天开花。\n因此,在第 9 天,所有种子都开花。 \n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>plantTime = [1], growTime = [1]\n<strong>输出:</strong>2\n<strong>解释:</strong>第 0 天,播种第 0 枚种子。种子需要生长 1 整天,然后在第 2 天开花。\n因此,在第 2 天,所有种子都开花。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == plantTime.length == growTime.length</code></li>\n\t<li><code>1 <= n <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= plantTime[i], growTime[i] <= 10<sup>4</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 23,
|
||||
"likes": 24,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3K\", \"totalSubmission\": \"4.7K\", \"totalAcceptedRaw\": 3013, \"totalSubmissionRaw\": 4720, \"acRate\": \"63.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"3.1K\", \"totalSubmission\": \"4.9K\", \"totalAcceptedRaw\": 3098, \"totalSubmissionRaw\": 4852, \"acRate\": \"63.8%\"}",
|
||||
"hints": [
|
||||
"List the planting like the diagram above shows, where a row represents the timeline of a seed. A row i is above another row j if the last day planting seed i is ahead of the last day for seed j. Does it have any advantage to spend some days to plant seed j before completely planting seed i?",
|
||||
"No. It does not help seed j but could potentially delay the completion of seed i, resulting in a worse final answer. Remaining focused is a part of the optimal solution.",
|
||||
|
Reference in New Issue
Block a user