mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-25 14:58:56 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个<code>points</code> 数组,表示 2D 平面上的一些点,其中 <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> 。</p>\n\n<p>连接点 <code>[x<sub>i</sub>, y<sub>i</sub>]</code> 和点 <code>[x<sub>j</sub>, y<sub>j</sub>]</code> 的费用为它们之间的 <strong>曼哈顿距离</strong> :<code>|x<sub>i</sub> - x<sub>j</sub>| + |y<sub>i</sub> - y<sub>j</sub>|</code> ,其中 <code>|val|</code> 表示 <code>val</code> 的绝对值。</p>\n\n<p>请你返回将所有点连接的最小总费用。只有任意两点之间 <strong>有且仅有</strong> 一条简单路径时,才认为所有点都已连接。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/08/26/d.png\" style=\"height:268px; width:214px; background:#e5e5e5\" /></p>\n\n<pre>\n<strong>输入:</strong>points = [[0,0],[2,2],[3,10],[5,2],[7,0]]\n<strong>输出:</strong>20\n<strong>解释:\n</strong><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/08/26/c.png\" style=\"height:268px; width:214px; background:#e5e5e5\" />\n我们可以按照上图所示连接所有点得到最小总费用,总费用为 20 。\n注意到任意两个点之间只有唯一一条路径互相到达。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>points = [[3,12],[-2,5],[-4,1]]\n<strong>输出:</strong>18\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>points = [[0,0],[1,1],[1,0],[-1,1]]\n<strong>输出:</strong>4\n</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre>\n<strong>输入:</strong>points = [[-1000000,-1000000],[1000000,1000000]]\n<strong>输出:</strong>4000000\n</pre>\n\n<p><strong>示例 5:</strong></p>\n\n<pre>\n<strong>输入:</strong>points = [[0,0]]\n<strong>输出:</strong>0\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= points.length <= 1000</code></li>\n\t<li><code>-10<sup>6</sup> <= x<sub>i</sub>, y<sub>i</sub> <= 10<sup>6</sup></code></li>\n\t<li>所有点 <code>(x<sub>i</sub>, y<sub>i</sub>)</code> 两两不同。</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 189,
|
||||
"likes": 190,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"32K\", \"totalSubmission\": \"48.2K\", \"totalAcceptedRaw\": 31985, \"totalSubmissionRaw\": 48205, \"acRate\": \"66.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"32.1K\", \"totalSubmission\": \"48.3K\", \"totalAcceptedRaw\": 32077, \"totalSubmissionRaw\": 48338, \"acRate\": \"66.4%\"}",
|
||||
"hints": [
|
||||
"Connect each pair of points with a weighted edge, the weight being the manhattan distance between those points.",
|
||||
"The problem is now the cost of minimum spanning tree in graph with above edges."
|
||||
|
||||
Reference in New Issue
Block a user