2101. Detonate the Maximum Bombs

#graph #bfs #dfs #geometry

Problem

Intuition

We need to break the problem into two parts

  • Building graph

  • Performing traversal(BFS/DFS) to find number of bombs that can be detonated

Here the detonated means the point (x, y) should lie inside the blast radius

Time Complexity

circle-info

Time complexity: O(n2)O(n^2)

  • Building graph -> O(n2)O(n^2)

  • Traversal of graph -> O(n2)O(n^2)

Total Time Complexity = Building graph + Traversal of graph

= O(n2)O(n^2) + O(n2)O(n^2) = 2 * O(n2)O(n^2) = O(n2)O(n^2)

Space Complexity

circle-check

Solution

Last updated