...

/

Detonate the Maximum Bombs

Detonate the Maximum Bombs

Try to solve the Detonate the Maximum Bombs problem.

Statement

You are given a list of bombs, where each bomb has a specific location and a range of effects. The range of a bomb is defined as a circular area centered at the bomb’s location, with a radius equal to the bomb’s range. If a bomb is detonated, it will trigger all other bombs whose centers lie within its range. These triggered bombs will further detonate any bombs within their respective ranges, creating a chain reaction.

The bombs are represented by a 0-indexed 2D integer array, bombs, where:

  • bombs[i] = [xi, yi, ri]:

    • xi and yi represent the X and Y coordinates of the bomb’s location.

    • ri represents the radius of the bomb’s range.

You may choose to detonate one bomb initially. Your task is to determine the maximum number of bombs that can be detonated if you start with the optimal choice of the initial bomb.

Note: A bomb will be detonated even if its location lies exactly on the boundary of another bomb’s detonation radius. ...

Access this course and 1400+ top-rated courses and projects.