Search
⌘K

Leetcode 2368. Reachable Nodes With Restrictions

Given an undirected tree and a set of restricted (blocked) nodes, count how many nodes are reachable from node 0 without visiting any restricted node by traversing the tree while skipping blocked nodes. Constraints: tree of up to 1e5 nodes, edges form a valid tree so a single DFS/BFS traversal suffices.


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.