Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2858. Minimum Edge Reversals So Every Node Is Reachable
Given a directed graph whose underlying undirected graph is a tree, compute for every node the minimum number of edge reversals required so that starting from that node you can reach all other nodes. This reduces to a tree shortest-path / rerooting problem by treating each original edge as cost 0 in its given direction and cost 1 if reversed, solvable with a 0-1 BFS or tree DP + rerooting to obtain answers for all nodes.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.