FastPrepDetonate Bombs with Chain Reactions
Problems/Detonate Bombs with Chain Reactions

Detonate Bombs with Chain Reactions

Google logoGoogle● MediumFULLTIMENEW GRADONSITE INTERVIEW

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

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.

More Google Onsite Interview questions

  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Distinct Subset SumsONSITE INTERVIEW · Seen Nov 2026
  • Playlist With No Same Artist in a RowONSITE INTERVIEW · Seen Nov 2026
  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • First and Last Target Position in a Mountain ArrayONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
  • Batched Subsequence Word MatchesONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Course ScheduleAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Course SchedulePlaud · ONSITE INTERVIEW
  • Explore an Unknown Grid and Find a PathLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Nearest Charging Station on a GridSpotify · ONSITE INTERVIEW
  • Hierarchical Permission CheckeBay · ONSITE INTERVIEWeBay interview questions
  • Island Count and Maximum AreaOracle · ONSITE INTERVIEWOracle interview questions
  • Evaluate DivisionPhonePe · ONSITE INTERVIEWPhonePe interview questions
  • Count Friend CirclesOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
  • Finite Web CrawlerMongoDB · PHONE SCREEN · ONSITE INTERVIEWMongoDB interview questions
  • Amount of Time to Infect a TreeMicrosoft · ONSITE INTERVIEWMicrosoft interview questions

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public int maximumDetonatedBombs(int[][] bombs) {
        // write your code here
    }

}
Checking account…