mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 07:35:35 +08:00
debug
This commit is contained in:
@ -131,9 +131,11 @@ private:
|
||||
}
|
||||
// 将v->u 这条边加入并查集
|
||||
void join(int u, int v) {
|
||||
if (isSame(u, v)) return ;
|
||||
u = find(u); // 寻找u的根
|
||||
v = find(v); // 寻找v的根
|
||||
if (u == v) return ; // 如果发现根相同,则说明在一个集合,不用两个节点相连直接返回
|
||||
father[v] = u;
|
||||
}
|
||||
}
|
||||
public:
|
||||
vector<int> findRedundantConnection(vector<vector<int>>& edges) {
|
||||
init();
|
||||
|
Reference in New Issue
Block a user