mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 05:26:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个 <strong>有向无环图</strong> , <code>n</code> 个节点编号为 <code>0</code> 到 <code>n-1</code> ,以及一个边数组 <code>edges</code> ,其中 <code>edges[i] = [from<sub>i</sub>, to<sub>i</sub>]</code> 表示一条从点 <code>from<sub>i</sub></code> 到点 <code>to<sub>i</sub></code> 的有向边。</p>\n\n<p>找到最小的点集使得从这些点出发能到达图中所有点。题目保证解存在且唯一。</p>\n\n<p>你可以以任意顺序返回这些节点编号。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/08/22/5480e1.png\" style=\"height: 181px; width: 231px;\"></p>\n\n<pre><strong>输入:</strong>n = 6, edges = [[0,1],[0,2],[2,5],[3,4],[4,2]]\n<strong>输出:</strong>[0,3]\n<strong>解释:</strong>从单个节点出发无法到达所有节点。从 0 出发我们可以到达 [0,1,2,5] 。从 3 出发我们可以到达 [3,4,2,5] 。所以我们输出 [0,3] 。</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/08/22/5480e2.png\" style=\"height: 201px; width: 201px;\"></p>\n\n<pre><strong>输入:</strong>n = 5, edges = [[0,1],[2,1],[3,1],[1,4],[2,4]]\n<strong>输出:</strong>[0,2,3]\n<strong>解释:</strong>注意到节点 0,3 和 2 无法从其他节点到达,所以我们必须将它们包含在结果点集中,这些点都能到达节点 1 和 4 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 <= n <= 10^5</code></li>\n\t<li><code>1 <= edges.length <= min(10^5, n * (n - 1) / 2)</code></li>\n\t<li><code>edges[i].length == 2</code></li>\n\t<li><code>0 <= from<sub>i,</sub> to<sub>i</sub> < n</code></li>\n\t<li>所有点对 <code>(from<sub>i</sub>, to<sub>i</sub>)</code> 互不相同。</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 38,
|
||||
"likes": 44,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -137,7 +137,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"10.9K\", \"totalSubmission\": \"13.8K\", \"totalAcceptedRaw\": 10908, \"totalSubmissionRaw\": 13797, \"acRate\": \"79.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"11.6K\", \"totalSubmission\": \"14.5K\", \"totalAcceptedRaw\": 11559, \"totalSubmissionRaw\": 14531, \"acRate\": \"79.5%\"}",
|
||||
"hints": [
|
||||
"A node that does not have any incoming edge can only be reached by itself.",
|
||||
"Any other node with incoming edges can be reached from some other node.",
|
||||
|
Reference in New Issue
Block a user