Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Can we find all the reachable nodes in a single traversal?
Traverse the graph from node 0 while avoiding the nodes in restricted and do not revisit nodes that have been visited.
Keep count of how many nodes are visited in total.