C++ || DFS || Intuitive || Clean Code
Intuition\nThe bombs will detonate all of the bombs which are in its range. So form groups which connects all bombs which are linked to each other.\nCount the n
# Intuition\nThe bombs will detonate all of the bombs which are in its range. So form groups which connects all bombs which are linked to each other.\nCount the number of bombs connected together in a group. The group with maximum number of bombs will be our answer.\n\n# Approach\nForm the a directed graph which connects the bombs. Run a dfs and count the number of bombs in each graph. The maximum would be our answer.\n\nRefer to the code for better understanding :)\n\n# Complexity\n- Time complexity:O(N*N)\n\n- Space complexity:O(N*N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    void dfs(int node, vector<int>& vis, vector<int> graph[], int& c){\n        vis[node] = 1;\n        c++;\n        for(auto child:graph[node]){\n            if(vis[child]) continue;\n            dfs(child, vis, graph, c);\n        }\n    }\n\n    int maximumDetonation(vector<vector<int>>& bombs) {\n        int n = bombs.size();\n        vector<int> graph[n];\n        for(int i=0; i<n; i++){\n            long long r = bombs[i][2];\n            int x = bombs[i][0];\n            int y = bombs[i][1];\n\n            for(int j=0; j<n; j++){\n                if(i==j) continue;\n                int x1 = bombs[j][0];\n                int y1 = bombs[j][1];\n                long long r1 = bombs[j][2];\n\n                long long dist = (pow(x-x1,2)+pow(y-y1,2));\n                if(dist <= (r*r)) graph[i].push_back(j);\n            }\n        }\n\n        int maxi=1;\n        for(int i=0; i<n; i++){\n            int c=0;\n            vector<int> vis(n,0);\n            dfs(i, vis, graph, c);\n            maxi = max(maxi, c);\n        }\n        return maxi;\n        \n    }\n};\n```
['Depth-First Search', 'Graph', 'Geometry', 'C++']