mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 13:36:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>在无限长的数轴(即 x 轴)上,我们根据给定的顺序放置对应的正方形方块。</p>\n\n<p>第 <code>i</code> 个掉落的方块(<code>positions[i] = (left, side_length)</code>)是正方形,其中 <code>left 表示该方块最左边的点位置(positions[i][0]),side_length 表示该方块的边长(positions[i][1])。</code></p>\n\n<p>每个方块的底部边缘平行于数轴(即 x 轴),并且从一个比目前所有的落地方块更高的高度掉落而下。在上一个方块结束掉落,并保持静止后,才开始掉落新方块。</p>\n\n<p>方块的底边具有非常大的粘性,并将保持固定在它们所接触的任何长度表面上(无论是数轴还是其他方块)。邻接掉落的边不会过早地粘合在一起,<code>因为只有底边才具有粘性。</code></p>\n\n<p> </p>\n\n<p>返回一个堆叠高度列表 <code>ans</code> 。每一个堆叠高度 <code>ans[i]</code> 表示在通过 <code>positions[0], positions[1], ..., positions[i]</code> 表示的方块掉落结束后,目前所有已经落稳的方块堆叠的最高高度。</p>\n\n<p> </p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong> [[1, 2], [2, 3], [6, 1]]\n<strong>输出:</strong> [2, 5, 5]\n<strong>解释:\n\n</strong>第一个方块 <code>positions[0] = [1, 2] </code>掉落:\n<code>_aa\n_aa\n-------\n</code>方块最大高度为 2 。\n\n第二个方块 <code>positions[1] = [2, 3] </code>掉落:\n<code>__aaa\n__aaa\n__aaa\n_aa__\n_aa__\n--------------\n</code>方块最大高度为5。\n大的方块保持在较小的方块的顶部,不论它的重心在哪里,因为方块的底部边缘有非常大的粘性。\n\n第三个方块 <code>positions[1] = [6, 1] </code>掉落:\n<code>__aaa\n__aaa\n__aaa\n_aa\n_aa___a\n-------------- \n</code>方块最大高度为5。\n\n因此,我们返回结果<code>[2, 5, 5]。</code>\n</pre>\n\n<p> </p>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong> [[100, 100], [200, 100]]\n<strong>输出:</strong> [100, 100]\n<strong>解释:</strong> 相邻的方块不会过早地卡住,只有它们的底部边缘才能粘在表面上。\n</pre>\n\n<p> </p>\n\n<p><strong>注意:</strong></p>\n\n<ul>\n\t<li><code>1 <= positions.length <= 1000</code>.</li>\n\t<li><code>1 <= positions[i][0] <= 10^8</code>.</li>\n\t<li><code>1 <= positions[i][1] <= 10^6</code>.</li>\n</ul>\n\n<p> </p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 72,
|
||||
"likes": 73,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"The Skyline Problem\", \"titleSlug\": \"the-skyline-problem\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u5929\\u9645\\u7ebf\\u95ee\\u9898\"}]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3.5K\", \"totalSubmission\": \"7.2K\", \"totalAcceptedRaw\": 3519, \"totalSubmissionRaw\": 7159, \"acRate\": \"49.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"3.7K\", \"totalSubmission\": \"7.5K\", \"totalAcceptedRaw\": 3684, \"totalSubmissionRaw\": 7488, \"acRate\": \"49.2%\"}",
|
||||
"hints": [
|
||||
"If positions = [[10, 20], [20, 30]], this is the same as [[1, 2], [2, 3]]. Currently, the values of positions are very large. Can you generalize this approach so as to make the values in positions manageable?"
|
||||
],
|
||||
|
Reference in New Issue
Block a user