C++ Simple DFS Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n\n\n# Code\n\nclass S
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n\n\n# Code\n```\nclass Solution {\npublic:\n    void dfs (unordered_map<int,vector<int>>&adj, int u, vector<bool>&visited, int &ans){\n\n        visited[u]=true;\n        ans++;\n\n        for(auto &it : adj[u]){\n            if(!visited[it]){\n                dfs(adj,it,visited,ans);\n            }\n        }\n    }\n    int maximumDetonation(vector<vector<int>>& bombs) {\n        \n        unordered_map<int,vector<int>> adj;\n        \n\n        for(int i=0; i<bombs.size(); i++){\n\n            int x1  =  bombs[i][0];\n            int y1  =  bombs[i][1];\n            int r1  =  bombs[i][2];\n\n            for(int j=i+1; j<bombs.size(); j++){\n\n                int x2  =  bombs[j][0];\n                int y2  =  bombs[j][1];\n                int r2  =  bombs[j][2];\n\n                double dist = pow(pow(x2-x1,2)+pow(y2-y1,2),0.5);\n\n                if(dist<=r1){\n                    adj[i].push_back(j);\n                }\n\n                if(dist<=r2){\n                    adj[j].push_back(i);\n                }\n            }\n        }\n\n        int ans = 1;\n\n        for(int i=0; i<bombs.size(); i++){\n\n            int currans = 0;\n            vector<bool>visited(bombs.size(),false);\n\n            dfs(adj,i,visited,currans);\n            ans = max(ans , currans);\n        }\n\n        return ans;\n    }\n};\n```
['Math', 'Depth-First Search', 'Graph', 'Geometry', 'C++']