← ALL NOTES
Depth-First Search

1466. Reorder Routes to Make All Paths Lead to the City Zero

n cities with n−1 directed edges forming a tree (if you ignore directions); find the minimum edges to reverse so every city can reach city 0. The insight: ignore directions to get a tree (so there's…

Loading…