mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 07:21:40 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数数组 <code>target</code> 。一开始,你有一个数组 <code>A</code> ,它的所有元素均为 1 ,你可以执行以下操作:</p>\n\n<ul>\n\t<li>令 <code>x</code> 为你数组里所有元素的和</li>\n\t<li>选择满足 <code>0 <= i < target.size</code> 的任意下标 <code>i</code> ,并让 <code>A</code> 数组里下标为 <code>i</code> 处的值为 <code>x</code> 。</li>\n\t<li>你可以重复该过程任意次</li>\n</ul>\n\n<p>如果能从 <code>A</code> 开始构造出目标数组 <code>target</code> ,请你返回 True ,否则返回 False 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>target = [9,3,5]\n<strong>输出:</strong>true\n<strong>解释:</strong>从 [1, 1, 1] 开始\n[1, 1, 1], 和为 3 ,选择下标 1\n[1, 3, 1], 和为 5, 选择下标 2\n[1, 3, 5], 和为 9, 选择下标 0\n[9, 3, 5] 完成\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>target = [1,1,1,2]\n<strong>输出:</strong>false\n<strong>解释:</strong>不可能从 [1,1,1,1] 出发构造目标数组。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>target = [8,5]\n<strong>输出:</strong>true\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>N == target.length</code></li>\n\t<li><code>1 <= target.length <= 5 * 10^4</code></li>\n\t<li><code>1 <= target[i] <= 10^9</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 64,
|
||||
"likes": 66,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3.2K\", \"totalSubmission\": \"11.4K\", \"totalAcceptedRaw\": 3180, \"totalSubmissionRaw\": 11353, \"acRate\": \"28.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"3.2K\", \"totalSubmission\": \"11.5K\", \"totalAcceptedRaw\": 3238, \"totalSubmissionRaw\": 11547, \"acRate\": \"28.0%\"}",
|
||||
"hints": [
|
||||
"Given that the sum is strictly increasing, the largest element in the target must be formed in the last step by adding the total sum in the previous step. Thus, we can simulate the process in a reversed way.",
|
||||
"Subtract the largest with the rest of the array, and put the new element into the array. Repeat until all elements become one"
|
||||
|
Reference in New Issue
Block a user