Python Elegant & Short | DFS
Complexity\n- Time complexity: O(n^{2})\n- Space complexity: O(n^{2})\n\n# Code\n\nclass Solution:\n    def maximumDetonation(self, bombs: List[List[int]]) -> i
# Complexity\n- Time complexity: $$O(n^{2})$$\n- Space complexity: $$O(n^{2})$$\n\n# Code\n```\nclass Solution:\n    def maximumDetonation(self, bombs: List[List[int]]) -> int:\n        def dfs(node: int, visited: set = None) -> set:\n            if visited is None:\n                visited = {node}\n\n            for child in graph[node]:\n                if child not in visited:\n                    visited.add(child)\n                    dfs(child, visited)\n\n            return visited\n\n        graph = defaultdict(set)\n\n        for i, (x1, y1, rad) in enumerate(bombs):\n            for j, (x2, y2, _) in enumerate(bombs):\n                if (x1 - x2) ** 2 + (y1 - y2) ** 2 <= rad ** 2:\n                    graph[i].add(j)\n\n        return max(len(dfs(i)) for i in range(len(bombs)))\n```
['Depth-First Search', 'Graph', 'Python', 'Python3']