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.
Asked at:
Microsoft
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late June, 2026
Microsoft
Mid-level
Late May, 2026
Microsoft
Senior
Part of OA.
Late May, 2026
Microsoft
Senior
Hello Interview Premium
Your account is free and you can post anonymously if you choose.