Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Remove Max Number of Edges to Keep Graph Fully Traversable

HardLeetCode 1579 ↗

The problem, in one line. Two walkers share a graph where some links only one of them can use and some both can. Remove as many links as possible while each walker can still reach every point, or return -1 if one already cannot. LeetCode 1579.

The tell. “Remove the most while everyone stays connected” means keep the fewest links, which is one spanning tree per walker. Each walker gets their own union-find, and a link is worth keeping only if it joins two groups for someone.

Included with a plan

This solution is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.