JAVA Solution | DFS Traversal
We just need to find out the maximum no. of connected components i.e. bombs\n\nclass Solution {\n    \n    public int maximumDetonation(int[][] bombs) {\n      
We just need to find out the maximum no. of connected components i.e. bombs\n```\nclass Solution {\n    \n    public int maximumDetonation(int[][] bombs) {\n        \n        List<List<Integer>> adj = new ArrayList<>();\n        int n = bombs.length;\n        boolean[] vis = new boolean[n];\n        int max=1;\n        \n        \n        for(int i=0;i<n;i++)\n            adj.add(new ArrayList<>());\n        \n        for(int i=0;i<n;i++){\n            long x = (long)bombs[i][0],y=(long)bombs[i][1],r=(long)bombs[i][2];\n            \n            for(int j=0;j<n;j++){\n               int x1 = bombs[j][0],y1=bombs[j][1],r1=bombs[j][2];\n                \n               if(i!=j){\n                   if((((x-x1)*(x-x1)+(y-y1)*(y-y1))<=r*r))\n                   adj.get(i).add(j);\n               }\n            }\n        }\n\n                \n        for(int i=0;i<n;i++){\n            int ans = DFS(i,adj,vis);\n            Arrays.fill(vis,false);\n            max = Math.max(ans,max);\n        }\n        \n        return max;\n        \n    }\n    \n    private int DFS(int i,List<List<Integer>> adj,boolean []vis){\n        vis[i]=true;\n        int ans =1;\n        for(int nd : adj.get(i)){\n            if(!vis[nd])\n                ans+=DFS(nd,adj,vis);\n        }\n        \n        return ans;\n    }\n}\n```
[]