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>candies</code> 和一个整数 <code>extraCandies</code> ,其中 <code>candies[i]</code> 代表第 <code>i</code> 个孩子拥有的糖果数目。</p>\n\n<p>对每一个孩子,检查是否存在一种方案,将额外的 <code>extraCandies</code> 个糖果分配给孩子们之后,此孩子有 <strong>最多</strong> 的糖果。注意,允许有多个孩子同时拥有 <strong>最多</strong> 的糖果数目。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>candies = [2,3,5,1,3], extraCandies = 3\n<strong>输出:</strong>[true,true,true,false,true] \n<strong>解释:</strong>\n孩子 1 有 2 个糖果,如果他得到所有额外的糖果(3个),那么他总共有 5 个糖果,他将成为拥有最多糖果的孩子。\n孩子 2 有 3 个糖果,如果他得到至少 2 个额外糖果,那么他将成为拥有最多糖果的孩子。\n孩子 3 有 5 个糖果,他已经是拥有最多糖果的孩子。\n孩子 4 有 1 个糖果,即使他得到所有额外的糖果,他也只有 4 个糖果,无法成为拥有糖果最多的孩子。\n孩子 5 有 3 个糖果,如果他得到至少 2 个额外糖果,那么他将成为拥有最多糖果的孩子。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>candies = [4,2,1,1,2], extraCandies = 1\n<strong>输出:</strong>[true,false,false,false,false] \n<strong>解释:</strong>只有 1 个额外糖果,所以不管额外糖果给谁,只有孩子 1 可以成为拥有糖果最多的孩子。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>candies = [12,1,12], extraCandies = 10\n<strong>输出:</strong>[true,false,true]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 <= candies.length <= 100</code></li>\n\t<li><code>1 <= candies[i] <= 100</code></li>\n\t<li><code>1 <= extraCandies <= 50</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 127,
|
||||
"likes": 128,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -131,7 +131,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"81.8K\", \"totalSubmission\": \"96.7K\", \"totalAcceptedRaw\": 81759, \"totalSubmissionRaw\": 96666, \"acRate\": \"84.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"82.4K\", \"totalSubmission\": \"97.5K\", \"totalAcceptedRaw\": 82399, \"totalSubmissionRaw\": 97452, \"acRate\": \"84.6%\"}",
|
||||
"hints": [
|
||||
"Use greedy approach. For each kid check if candies[i] + extraCandies ≥ maximum in Candies[i]."
|
||||
],
|
||||
|
Reference in New Issue
Block a user