Search
⌘K

Leetcode 1579. Remove Max Number of Edges to Keep Graph Fully Traversable

Given an undirected graph with edges usable by Alice-only, Bob-only, or both, compute the maximum number of edges you can remove while still allowing both Alice and Bob to traverse the entire graph (return -1 if impossible). This is a connectivity/union-find problem where you must optimally choose edges—typically by greedily using shared (type-3) edges first—to keep both users' graphs connected and count redundant edges.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.