mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 15:31:43 +08:00
update
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "1335",
|
||||
"questionFrontendId": "5219",
|
||||
"questionFrontendId": "2226",
|
||||
"categoryTitle": "Algorithms",
|
||||
"boundTopicId": 1385505,
|
||||
"title": "Maximum Candies Allocated to K Children",
|
||||
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个 <strong>下标从 0 开始</strong> 的整数数组 <code>candies</code> 。数组中的每个元素表示大小为 <code>candies[i]</code> 的一堆糖果。你可以将每堆糖果分成任意数量的 <strong>子堆</strong> ,但 <strong>无法</strong> 再将两堆合并到一起。</p>\n\n<p>另给你一个整数 <code>k</code> 。你需要将这些糖果分配给 <code>k</code> 个小孩,使每个小孩分到 <strong>相同</strong> 数量的糖果。每个小孩可以拿走 <strong>至多一堆</strong> 糖果,有些糖果可能会不被分配。</p>\n\n<p>返回每个小孩可以拿走的 <strong>最大糖果数目</strong><em> </em>。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>candies = [5,8,6], k = 3\n<strong>输出:</strong>5\n<strong>解释:</strong>可以将 candies[1] 分成大小分别为 5 和 3 的两堆,然后把 candies[2] 分成大小分别为 5 和 1 的两堆。现在就有五堆大小分别为 5、5、3、5 和 1 的糖果。可以把 3 堆大小为 5 的糖果分给 3 个小孩。可以证明无法让每个小孩得到超过 5 颗糖果。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>candies = [2,5], k = 11\n<strong>输出:</strong>0\n<strong>解释:</strong>总共有 11 个小孩,但只有 7 颗糖果,但如果要分配糖果的话,必须保证每个小孩至少能得到 1 颗糖果。因此,最后每个小孩都没有得到糖果,答案是 0 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= candies.length <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= candies[i] <= 10<sup>7</sup></code></li>\n\t<li><code>1 <= k <= 10<sup>12</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 12,
|
||||
"likes": 26,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"5.1K\", \"totalSubmission\": \"17.7K\", \"totalAcceptedRaw\": 5107, \"totalSubmissionRaw\": 17667, \"acRate\": \"28.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"7.7K\", \"totalSubmission\": \"24.1K\", \"totalAcceptedRaw\": 7698, \"totalSubmissionRaw\": 24128, \"acRate\": \"31.9%\"}",
|
||||
"hints": [
|
||||
"For a fixed number of candies c, how can you check if each child can get c candies?",
|
||||
"Use binary search to find the maximum c as the answer."
|
||||
|
Reference in New Issue
Block a user