mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-07 08:21:41 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数 <code>finalSum</code> 。请你将它拆分成若干个 <strong>互不相同</strong> 的正偶数之和,且拆分出来的正偶数数目 <strong>最多</strong> 。</p>\n\n<ul>\n\t<li>比方说,给你 <code>finalSum = 12</code> ,那么这些拆分是 <strong>符合要求</strong> 的(互不相同的正偶数且和为 <code>finalSum</code>):<code>(2 + 10)</code> ,<code>(2 + 4 + 6)</code> 和 <code>(4 + 8)</code> 。它们中,<code>(2 + 4 + 6)</code> 包含最多数目的整数。注意 <code>finalSum</code> 不能拆分成 <code>(2 + 2 + 4 + 4)</code> ,因为拆分出来的整数必须互不相同。</li>\n</ul>\n\n<p>请你返回一个整数数组,表示将整数拆分成 <strong>最多</strong> 数目的正偶数数组。如果没有办法将 <code>finalSum</code> 进行拆分,请你返回一个 <strong>空</strong> 数组。你可以按 <b>任意</b> 顺序返回这些整数。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<b>输入:</b>finalSum = 12\n<b>输出:</b>[2,4,6]\n<b>解释:</b>以下是一些符合要求的拆分:<code>(2 + 10)<span style=\"\">,</span></code><code>(2 + 4 + 6) </code>和 <code>(4 + 8) 。</code>\n(2 + 4 + 6) 为最多数目的整数,数目为 3 ,所以我们返回 [2,4,6] 。\n[2,6,4] ,[6,2,4] 等等也都是可行的解。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<b>输入:</b>finalSum = 7\n<b>输出:</b>[]\n<b>解释:</b>没有办法将 finalSum 进行拆分。\n所以返回空数组。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<b>输入:</b>finalSum = 28\n<b>输出:</b>[6,8,2,12]\n<b>解释:</b>以下是一些符合要求的拆分:<code>(2 + 26)<span style=\"\">,</span></code><code>(6 + 8 + 2 + 12)</code> 和 <code>(4 + 24) 。</code>\n<code>(6 + 8 + 2 + 12)</code> 有最多数目的整数,数目为 4 ,所以我们返回 [6,8,2,12] 。\n[10,2,4,12] ,[6,2,4,16] 等等也都是可行的解。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= finalSum <= 10<sup>10</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 9,
|
||||
"likes": 10,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"5.1K\", \"totalSubmission\": \"9.3K\", \"totalAcceptedRaw\": 5106, \"totalSubmissionRaw\": 9261, \"acRate\": \"55.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"5.3K\", \"totalSubmission\": \"9.7K\", \"totalAcceptedRaw\": 5344, \"totalSubmissionRaw\": 9664, \"acRate\": \"55.3%\"}",
|
||||
"hints": [
|
||||
"First, check if finalSum is divisible by 2. If it isn’t, then we cannot split it into even integers.",
|
||||
"Let k be the number of elements in our split. As we want the maximum number of elements, we should try to use the first k - 1 even elements to grow our sum as slowly as possible.",
|
||||
|
Reference in New Issue
Block a user