← 返回 apple 的题目列表Redundant Connection
类型:qbank
In this problem, a tree is an undirected graph that is connected and has no cycles.
Examples
Example 1:
Input: edges = [[1,2],[1,3],[2,3]]
Output: [2,3]
Example 2:
Input: edges = [[1,2],[2,3],[3,4],[1,4],[1,5]]
Output: [1,4]
Constraints
n == edges.length
3 <= n <= 1000
edges[i].length == 2
1 <= ai < bi <= edges.length