The redundant edge is the one that forms a cycle.
Union-Find (DSU):
(u,v), if u and v already have the same root, this edge is redundant.
Return the last such edge.DSU tracks connected components. An edge within the same component closes a cycle.
The redundant edge is the one that forms a cycle.
Union-Find (DSU):
(u,v), if u and v already have the same root, this edge is redundant.
Return the last such edge.DSU tracks connected components. An edge within the same component closes a cycle.