An Easy DFS solution approach || C++
Intuition\n Describe your first thoughts on how to solve this problem. \nIf one bomb explodes and the bombs that comes inside its range, it\'s the indication th
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nIf one bomb explodes and the bombs that comes inside its range, it\'s the indication that its a dfs/bfs problem\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nHere, i have discussed the dfs approach, just running dfs for each bomb (with a new visited array each time) to see how many bombs will explode if that bomb explodes, and then take max out of all.\nI have set the ans initially to one, cause in the worst case 1 bomb will always explode as given in question\n\n# Complexity\n- Time complexity: O(n^2), In the worst case for all dfs calls all bombs will be visited\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n- n = no. of bombs\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n\n# Code\n```\nclass Solution {\npublic:\n    int dfs(vector<vector<int>>& bombs, int i, vector<int>& visited){\n        int n = bombs.size();\n        visited[i]=1;\n        // return 1 + dfs call to the bombs in ranges if not visited\n\n        int output = 1;\n        for(int j=0;j<n;j++){\n            double tot_dist = sqrt(pow(bombs[i][0]-bombs[j][0],2) + pow(bombs[i][1]-bombs[j][1],2));\n            if(visited[j]==0 && tot_dist<=bombs[i][2]){\n                output+= dfs(bombs,j,visited);\n            }\n        }\n        return output;\n    }\n\n    int maximumDetonation(vector<vector<int>>& bombs) {\n        // I guess my approach after thinking would be a dfs approach, if a bomb denotes dfs to the bomb in its ranges and return the max output out of all dfs calls\n        int n = bombs.size();\n        \n        int ans = 1;\n        for(int i=0;i<n;i++){\n            vector<int> visited(n,0);\n            ans = max(ans,dfs(bombs,i,visited));\n        }\n        return ans;\n    }\n};\n```
['Array', 'Depth-First Search', 'Breadth-First Search', 'C++']