Skip to main content
LeetCode 2101, Medium. Topics: Array, Math, Depth-First Search, Breadth-First Search, Graph Theory, Geometry. View on LeetCode. Generate this problem as a practice environment: tested reference solution, 20 parametrized pytest cases, and a playground notebook:

Problem

You are given a list of bombs. The range of a bomb is defined as the area where its effect can be felt. This area is in the shape of a circle with the center as the location of the bomb. The bombs are represented by a 0-indexed 2D integer array bombs where bombs[i] = [x<sub>i</sub>, y<sub>i</sub>, r<sub>i</sub>]. x<sub>i</sub> and y<sub>i</sub> denote the X-coordinate and Y-coordinate of the location of the i<sup>th</sup> bomb, whereas r<sub>i</sub> denotes the radius of its range. You may choose to detonate a single bomb. When a bomb is detonated, it will detonate all bombs that lie in its range. These bombs will further detonate the bombs that lie in their ranges. Given the list of bombs, return the maximum number of bombs that can be detonated if you are allowed to detonate only one bomb.

Examples

Example 1
Example 2
Example 3

Constraints

  • 1 <= bombs.length <= 100
  • bombs[i].length == 3
  • 1 <= x<sub>i</sub>, y<sub>i</sub>, r<sub>i</sub> <= 10<sup>5</sup>
Follow up: Can you solve it without building the graph explicitly?

Solution

Reference implementation from solution.py on GitHub, full suite in test_solution.py:

Complexity

Tags

NeetCode All.
Last modified on September 7, 2026