Understandable Explanation | Graph visualized
Intuition\n Describe your first thoughts on how to solve this problem. \nHow can we visiualize the problem?\nWhich data structure should we use ?\n\nThe key to 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nHow can we visiualize the problem?\nWhich data structure should we use ?\n\nThe key to the solution is just visualization, if you crack that this question is a piece of cake.\n\nThink of a single detonation some other bombs and those other bombs are detonating further or they even might detonate a previous one.\nAren\'t you getting a feel of chain. A chain which might contain cycles , or some disconnected parts .\nWe can visualize bombs as vertices with their detonation connection as directed edge between them.\nAlso look at the constraints first we do not have to worry about time complexity much, an n^2 solution with be fairly good.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nImplement an inRange(bomb a,bomb b) funciton to check weather bomb b is in the range of a or not. You can easily check using basic co-ordinate geometry (remember class 12). I am shifting origin to co-ordinates of bomb a and checking now if co-ordinates of other bomb will lie in the range (x*x + y*y <= r*r) it will get detonated.\n\nNow create a directed graph with all pairs of (i,j) (i and j here represents bombs 0,1,2....n-1) and check if j is in the range of i there will be an edge from i to j.\n\nNow the question to just count the maximum number of reachable node from a single node and as we can go for O(n^2) we can simply run a bfs or dfs traversal from every node and count the number of nodes and return the maximum.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n^2)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(n)\n\n# Code\n```\nclass Solution {\npublic:\n    int n;\n   \n    bool inRange(vector<int> v1,vector<int> v2)\n    {\n        long long x1 = v1[0],y1 = v1[1] , r = v1[2];\n        long long x2 = v2[0] , y2 = v2[1];\n\n        x2 -= x1;\n        y2 -= y1;\n\n        if(x2*x2 + y2*y2 <= r*r) return true;\n        return false;\n    }\n\n    int bfs(unordered_map<int,vector<int>> &adj,int node)\n    {\n        queue<int> q;\n        vector<bool> visited(n+1,false); \n        visited[node]=true;\n        q.push(node);\n        int ans = 0;\n        while(!q.empty())\n        {\n            ans++;\n\n            int temp = q.front();\n           \n            q.pop();\n            for(auto i : adj[temp])\n            {\n                if(!visited[i]) q.push(i);\n                visited[i] = true;\n            }\n        }\n\n        return ans;\n    }\n    int maximumDetonation(vector<vector<int>>& bombs)\n    {\n        n = bombs.size();\n\n        unordered_map<int,vector<int>> adj;\n        for(int i=0;i<n;i++)\n        {\n            for(int j=0;j<n;j++)\n            {\n                if(i==j) continue;\n\n                if(inRange(bombs[i],bombs[j]))\n                {\n                    adj[i+1].push_back(j+1);\n                }\n            }\n        }\n\n        int ans = -1;\n       \n        for(int i=1;i<=n;i++)\n        {\n            ans = max(ans,bfs(adj,i));\n       \n        }\n\n        return ans;\n    }\n};\n```
['Graph', 'C++']