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>有一堆石头,每块石头的重量都是正整数。</p>\n\n<p>每一回合,从中选出两块<strong> 最重的</strong> 石头,然后将它们一起粉碎。假设石头的重量分别为 <code>x</code> 和 <code>y</code>,且 <code>x <= y</code>。那么粉碎的可能结果如下:</p>\n\n<ul>\n\t<li>如果 <code>x == y</code>,那么两块石头都会被完全粉碎;</li>\n\t<li>如果 <code>x != y</code>,那么重量为 <code>x</code> 的石头将会完全粉碎,而重量为 <code>y</code> 的石头新重量为 <code>y-x</code>。</li>\n</ul>\n\n<p>最后,最多只会剩下一块石头。返回此石头的重量。如果没有石头剩下,就返回 <code>0</code>。</p>\n\n<p> </p>\n\n<p><strong>示例:</strong></p>\n\n<pre>\n<strong>输入:</strong>[2,7,4,1,8,1]\n<strong>输出:</strong>1\n<strong>解释:</strong>\n先选出 7 和 8,得到 1,所以数组转换为 [2,4,1,1,1],\n再选出 2 和 4,得到 2,所以数组转换为 [2,1,1,1],\n接着是 2 和 1,得到 1,所以数组转换为 [1,1,1],\n最后选出 1 和 1,得到 0,最终数组转换为 [1],这就是最后剩下那块石头的重量。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= stones.length <= 30</code></li>\n\t<li><code>1 <= stones[i] <= 1000</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 200,
|
||||
"likes": 207,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"72.5K\", \"totalSubmission\": \"110.1K\", \"totalAcceptedRaw\": 72486, \"totalSubmissionRaw\": 110142, \"acRate\": \"65.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"73.9K\", \"totalSubmission\": \"112.3K\", \"totalAcceptedRaw\": 73883, \"totalSubmissionRaw\": 112304, \"acRate\": \"65.8%\"}",
|
||||
"hints": [
|
||||
"Simulate the process. We can do it with a heap, or by sorting some list of stones every time we take a turn."
|
||||
],
|
||||
|
Reference in New Issue
Block a user