mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-21 21:16:45 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你 <code>n</code> 个长方体 <code>cuboids</code> ,其中第 <code>i</code> 个长方体的长宽高表示为 <code>cuboids[i] = [width<sub>i</sub>, length<sub>i</sub>, height<sub>i</sub>]</code>(<strong>下标从 0 开始</strong>)。请你从 <code>cuboids</code> 选出一个 <strong>子集</strong> ,并将它们堆叠起来。</p>\n\n<p>如果 <code>width<sub>i</sub> <= width<sub>j</sub></code> 且 <code>length<sub>i</sub> <= length<sub>j</sub></code> 且 <code>height<sub>i</sub> <= height<sub>j</sub></code> ,你就可以将长方体 <code>i</code> 堆叠在长方体 <code>j</code> 上。你可以通过旋转把长方体的长宽高重新排列,以将它放在另一个长方体上。</p>\n\n<p>返回 <strong>堆叠长方体</strong> <code>cuboids</code> 可以得到的 <strong>最大高度</strong> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><strong><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/12/12/image.jpg\" style=\"width: 420px; height: 299px;\" /></strong></p>\n\n<pre>\n<strong>输入:</strong>cuboids = [[50,45,20],[95,37,53],[45,23,12]]\n<strong>输出:</strong>190\n<strong>解释:</strong>\n第 1 个长方体放在底部,53x37 的一面朝下,高度为 95 。\n第 0 个长方体放在中间,45x20 的一面朝下,高度为 50 。\n第 2 个长方体放在上面,23x12 的一面朝下,高度为 45 。\n总高度是 95 + 50 + 45 = 190 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>cuboids = [[38,25,45],[76,35,3]]\n<strong>输出:</strong>76\n<strong>解释:</strong>\n无法将任何长方体放在另一个上面。\n选择第 1 个长方体然后旋转它,使 35x3 的一面朝下,其高度为 76 。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>cuboids = [[7,11,17],[7,17,11],[11,7,17],[11,17,7],[17,7,11],[17,11,7]]\n<strong>输出:</strong>102\n<strong>解释:</strong>\n重新排列长方体后,可以看到所有长方体的尺寸都相同。\n你可以把 11x7 的一面朝下,这样它们的高度就是 17 。\n堆叠长方体的最大高度为 6 * 17 = 102 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == cuboids.length</code></li>\n\t<li><code>1 <= n <= 100</code></li>\n\t<li><code>1 <= width<sub>i</sub>, length<sub>i</sub>, height<sub>i</sub> <= 100</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 35,
|
||||
"likes": 36,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"2.8K\", \"totalSubmission\": \"5.6K\", \"totalAcceptedRaw\": 2759, \"totalSubmissionRaw\": 5581, \"acRate\": \"49.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"2.8K\", \"totalSubmission\": \"5.7K\", \"totalAcceptedRaw\": 2812, \"totalSubmissionRaw\": 5683, \"acRate\": \"49.5%\"}",
|
||||
"hints": [
|
||||
"Does the dynamic programming sound like the right algorithm after sorting?",
|
||||
"Let's say box1 can be placed on top of box2. No matter what orientation box2 is in, we can rotate box1 so that it can be placed on top. Why don't we orient everything such that height is the biggest?"
|
||||
|
Reference in New Issue
Block a user