C++ || DFS || Connected Component Count
\n\t\n\t// Function to calculate dis^2 between two points\n    long long dis(int x1, int y1, int x2, int y2)\n    {\n        return pow(x2-x1,2) + pow(y2-y1,2);
\n\t\n\t// Function to calculate dis^2 between two points\n    long long dis(int x1, int y1, int x2, int y2)\n    {\n        return pow(x2-x1,2) + pow(y2-y1,2);\n    }\n    // DFS connected components count\n    void dfs(int node, vector<vector<int>> &adj, vector<bool>& visited , int &count)\n    {\n        if(visited[node]) return;\n        \n        visited[node]=true;\n        \n        // increment count each time we visit a new node\n        count++;\n        \n        for(auto i: adj[node])\n            if(!visited[i])\n                dfs(i,adj,visited,count);\n    }\n    int maximumDetonation(vector<vector<int>>& bomb) {\n        \n        int n=bomb.size();\n        \n        vector<vector<int>> adj(n);\n        \n        // for every comparison of bomb i->j check if the distance between the center of those two\n        // bombs is less than or equal to the radius of either of the bomb. If yes then push them\n        // adj[i] = {j} means that if we trigger i, j will be triggered\n        for(int i=0;i<n;i++)\n            for(int j=i+1;j<n;j++)\n            {\n                long long r =dis(bomb[i][0],bomb[i][1],bomb[j][0],bomb[j][1]);\n                if(r<= pow(bomb[i][2],2)) adj[i].push_back(j);\n                if(r<= pow(bomb[j][2],2)) adj[j].push_back(i);\n            }\n        \n        int ans=INT_MIN;\n        \n        vector<bool> visited;\n        \n        // perform DFS for every bomb\n        for(int i=0;i<n;i++)\n        {\n            visited=vector(n,false);\n            int count=0;\n            dfs(i,adj,visited,count);\n            ans=max(ans,count);\n        }\n        \n        return ans;\n    }\n\t\n
['Depth-First Search', 'C', 'C++']