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>mass</code> ,它表示一颗行星的初始质量。再给你一个整数数组 <code>asteroids</code> ,其中 <code>asteroids[i]</code> 是第 <code>i</code> 颗小行星的质量。</p>\n\n<p>你可以按 <strong>任意顺序</strong> 重新安排小行星的顺序,然后让行星跟它们发生碰撞。如果行星碰撞时的质量 <strong>大于等于</strong> 小行星的质量,那么小行星被 <strong>摧毁</strong> ,并且行星会 <strong>获得</strong> 这颗小行星的质量。否则,行星将被摧毁。</p>\n\n<p>如果所有小行星 <strong>都</strong> 能被摧毁,请返回 <code>true</code> ,否则返回 <code>false</code> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><b>输入:</b>mass = 10, asteroids = [3,9,19,5,21]\n<b>输出:</b>true\n<b>解释:</b>一种安排小行星的方式为 [9,19,5,3,21] :\n- 行星与质量为 9 的小行星碰撞。新的行星质量为:10 + 9 = 19\n- 行星与质量为 19 的小行星碰撞。新的行星质量为:19 + 19 = 38\n- 行星与质量为 5 的小行星碰撞。新的行星质量为:38 + 5 = 43\n- 行星与质量为 3 的小行星碰撞。新的行星质量为:43 + 3 = 46\n- 行星与质量为 21 的小行星碰撞。新的行星质量为:46 + 21 = 67\n所有小行星都被摧毁。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><b>输入:</b>mass = 5, asteroids = [4,9,23,4]\n<b>输出:</b>false\n<b>解释:</b>\n行星无论如何没法获得足够质量去摧毁质量为 23 的小行星。\n行星把别的小行星摧毁后,质量为 5 + 4 + 9 + 4 = 22 。\n它比 23 小,所以无法摧毁最后一颗小行星。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= mass <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= asteroids.length <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= asteroids[i] <= 10<sup>5</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 8,
|
||||
"likes": 9,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6.3K\", \"totalSubmission\": \"13.1K\", \"totalAcceptedRaw\": 6340, \"totalSubmissionRaw\": 13138, \"acRate\": \"48.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"6.4K\", \"totalSubmission\": \"13.2K\", \"totalAcceptedRaw\": 6354, \"totalSubmissionRaw\": 13164, \"acRate\": \"48.3%\"}",
|
||||
"hints": [
|
||||
"Choosing the asteroid to collide with can be done greedily.",
|
||||
"If an asteroid will destroy the planet, then every bigger asteroid will also destroy the planet.",
|
||||
|
Reference in New Issue
Block a user