Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
How can we model the relationship between different bombs? Can "graphs" help us?
Bombs are nodes and are connected to other bombs in their range by directed edges.
If we know which bombs will be affected when any bomb is detonated, how can we find the total number of bombs that will be detonated if we start from a fixed bomb?
Run a Depth First Search (DFS) from every node, and all the nodes it reaches are the bombs that will be detonated.