Max Number Of Edges To Remove For Full Traversal
Remove max edges to keep graph fully traversable: use UnionFind to track Alice & Bob's traversal, sort edges by type and remove required ones.
1579. Remove Max Number of Edges to Keep Graph Fully Traversable Hard Alice and Bob have an undirected graph of n nodes and three types of edges: Type 1: Can be traversed by Alice only. Type 2: Can be traversed by Bob only. Type 3: Can be traversed by both Alice and Bob. Given an array edges where edges[i] = [typei, ui, vi] represents a bidirectional edge of type typei between nodes ui and vi, find the maximum number of edges you can remove so that after removing the edges, the graph can still be fully traversed by both Alice and Bob. The graph is fully traversed by Alice and Bob if starting...
