Reported May 2026
Googlegraph

Detonate Bombs with Chain Reactions

Reported by candidates from Google's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Google OA. Under 2s to a working solution.
Founder's read

The whole problem hinges on one data structure: a directed graph you build yourself from raw coordinates. Google reported this one in May 2026, and it looks like geometry but it isn't. Each bomb is a node, and an edge runs from bomb i to bomb j when j sits inside i's radius. Pick the start bomb that reaches the most nodes. With n capped at 100, brute force is fine. If you blank on the graph idea mid-assessment, StealthCoder runs invisibly on your desktop and can hand you the approach so you keep moving.

The problem

You are given n bombs. Each bomb is represented as [x, y, r], where (x, y) is its location and r is its explosion radius.
If bomb i is detonated, it directly triggers every bomb j whose Euclidean distance from bomb i is at most r_i. A triggered bomb can then trigger other bombs, creating a chain reaction.
You may choose exactly one bomb as the initial detonation. Return the maximum number of bombs that can be detonated.

Function
maximumDetonatedBombs(bombs: int[][]) → int

Examples
Example 1
bombs = [[2,1,3],[6,1,4],[4,1,1]]
return = 3
Detonating the second bomb triggers both other bombs directly, so all three bombs detonate.
Example 2
bombs = [[0,0,1],[3,0,1]]
return = 1
Example 3
bombs = [[0,0,10],[3,0,1],[6,0,1]]
return = 3

Constraints
1 <= bombs.length <= 100
bombs[i].length == 3
-10^5 <= x_i, y_i <= 10^5
1 <= r_i <= 10^5
Use 64-bit squared distances to avoid overflow and floating-point precision issues.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Build an adjacency list. For every ordered pair (i, j), add edge i to j if (xi-xj)^2 + (yi-yj)^2 <= ri^2. Compare squared values in 64-bit integers. Never use sqrt or floats, the constraints call this out for a reason. Then run DFS or BFS from every bomb and count visited nodes. Return the max. That's O(n^3) worst case with n at 100, which is nothing. The classic pitfall is making the graph undirected. It's directed. A huge bomb can trigger a tiny one, but the tiny one can't trigger it back, as Example 3 shows. Also keep a visited set per start, or cycles will loop forever. Overflow is the other trap: 2*10^5 squared is 4*10^10, which breaks 32-bit ints. If the code won't come together live, StealthCoder is the hedge, reading the problem and giving you a working solution.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Detonate Bombs with Chain Reactions cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as detonate the maximum bombs. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Google's OA.

Google reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Detonate Bombs with Chain Reactions FAQ

What's the trick in the Google detonate bombs problem?+

Model it as a directed graph. Edge i to j exists if j is within i's radius. Then run DFS or BFS from each bomb and take the largest reachable count. The direction matters, because explosion range isn't symmetric.

Why not use floating-point distance?+

Precision errors can flip a boundary case where distance equals the radius exactly. Compare squared distance to radius squared using 64-bit integers. Coordinates reach 10^5, so squared sums overflow 32-bit ints.

What's the time complexity, and is it fast enough?+

Building the graph is O(n^2). Running a traversal from every bomb is O(n * (n + edges)), so O(n^3) worst case. With n at most 100 that's about a million operations, which is easily fast enough.

Should I use DFS or BFS?+

Either works. Both count reachable nodes from a start. DFS is shorter to write recursively, and BFS avoids recursion depth worries. Depth is at most 100 here, so pick whichever you can write without bugs.

How do I prepare for this in 48 hours?+

Write it once from scratch: build adjacency, traverse from each node, track visited, take the max. Test Example 3 to confirm the directed edges. Then practice a couple of other reachability-in-a-graph problems so the pattern feels automatic.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Google.

OA at Google?
Invisible during screen share
Get it