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>ratings</code> 表示每个孩子的评分。</p>\n\n<p>你需要按照以下要求,给这些孩子分发糖果:</p>\n\n<ul>\n\t<li>每个孩子至少分配到 <code>1</code> 个糖果。</li>\n\t<li>相邻两个孩子评分更高的孩子会获得更多的糖果。</li>\n</ul>\n\n<p>请你给每个孩子分发糖果,计算并返回需要准备的 <strong>最少糖果数目</strong> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>ratings = [1,0,2]\n<strong>输出:</strong>5\n<strong>解释:</strong>你可以分别给第一个、第二个、第三个孩子分发 2、1、2 颗糖果。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>ratings = [1,2,2]\n<strong>输出:</strong>4\n<strong>解释:</strong>你可以分别给第一个、第二个、第三个孩子分发 1、2、1 颗糖果。\n 第三个孩子只得到 1 颗糖果,这满足题面中的两个条件。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == ratings.length</code></li>\n\t<li><code>1 <= n <= 2 * 10<sup>4</sup></code></li>\n\t<li><code>0 <= ratings[i] <= 2 * 10<sup>4</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 802,
|
||||
"likes": 803,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"129.9K\", \"totalSubmission\": \"265.9K\", \"totalAcceptedRaw\": 129907, \"totalSubmissionRaw\": 265893, \"acRate\": \"48.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"130.6K\", \"totalSubmission\": \"267.4K\", \"totalAcceptedRaw\": 130607, \"totalSubmissionRaw\": 267433, \"acRate\": \"48.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
Reference in New Issue
Block a user