Build a directed graph where there's an edge from i to j if j falls within i's blast radius, then run BFS or DFS from each node and track the max reachable count.
Model the bombs as a directed graph where an edge from i to j exists if bomb j lies within bomb i's blast radius. Then the problem reduces to finding the node with the largest reachable set, which can be computed using graph traversal (DFS/BFS) from each node or more efficiently with SCC condensation and DP. Finally, return the size of the largest reachable set.
Pro tip: Mention that building the graph naively is O(n^2), but for large n you can optimize edge construction using spatial indexing (e.g., k-d tree or grid) to avoid TLE. Also, clarify that the graph is directed: i can trigger j even if j cannot trigger i.
Confirm that detonation is directional (i triggers j if j is within i's radius) and that you can choose exactly one starting bomb. Ask about input size to determine if O(n^2) is acceptable.
Create a directed graph with n nodes. For each bomb i, add edges to all bombs j (j ≠ i) such that the distance between i and j is ≤ radius_i. This captures the chain reaction.
For each node, perform DFS/BFS to find all reachable nodes. The answer is the maximum size among these sets. If n is large, consider SCC condensation to avoid redundant traversals.
If n is large (e.g., >10^4), optimize graph construction using spatial data structures (e.g., k-d tree, grid) and use SCC + DP on the condensed DAG to compute reachable set sizes efficiently.
State the complexity: O(n^2) for naive graph building and O(n*(n+m)) for BFS from each node, where m is number of edges. With SCC+DP, it's O(n+m) after building the graph.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.