1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-02 22:13:28 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-03-29 16:56:27 +08:00
parent e730aa6794
commit ad15da05aa
2517 changed files with 7358 additions and 7332 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个整数&nbsp;<code>mass</code>&nbsp;,它表示一颗行星的初始质量。再给你一个整数数组&nbsp;<code>asteroids</code>&nbsp;,其中&nbsp;<code>asteroids[i]</code>&nbsp;是第&nbsp;<code>i</code>&nbsp;颗小行星的质量。</p>\n\n<p>你可以按 <strong>任意顺序</strong>&nbsp;重新安排小行星的顺序,然后让行星跟它们发生碰撞。如果行星碰撞时的质量 <strong>大于等于</strong>&nbsp;小行星的质量,那么小行星被 <strong>摧毁</strong>&nbsp;,并且行星会 <strong>获得</strong>&nbsp;这颗小行星的质量。否则,行星将被摧毁。</p>\n\n<p>如果所有小行星 <strong>都</strong>&nbsp;能被摧毁,请返回 <code>true</code>&nbsp;,否则返回 <code>false</code>&nbsp;。</p>\n\n<p>&nbsp;</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>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= mass &lt;= 10<sup>5</sup></code></li>\n\t<li><code>1 &lt;= asteroids.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>1 &lt;= asteroids[i] &lt;= 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.",