[C++] | BFS | Beginner - Friendly | O(N^3)
\nclass Solution {\npublic:\n    long long int cnt;\n    long long get(vector<vector<int> > &ar, int i, int n){\n        vector<int> vis(n,0);\n        queue<ve
```\nclass Solution {\npublic:\n    long long int cnt;\n    long long get(vector<vector<int> > &ar, int i, int n){\n        vector<int> vis(n,0);\n        queue<vector<int> > q;\n        \n        vis[i] = 1;\n        cnt++;\n        \n        q.push(ar[i]);\n        while(!q.empty()){\n            auto cur = q.front();\n            q.pop();\n            \n            for(int j = 0; j < n; j++){\n                if(!vis[j]){\n                    long long int a = (ar[j][0] * 1ll - cur[0] * 1ll) * (ar[j][0] * 1ll - cur[0] * 1ll);    \n                    long long int b = (ar[j][1] * 1ll - cur[1] * 1ll) * (ar[j][1] * 1ll - cur[1] * 1ll);\n                    long long int c = cur[2] * 1ll * cur[2];\n                    \n                    // Check whether centre of new circle lies \n                    // on or inside the current circle\n                    long long int k = a + b - c;\n                    if(k <= 0){\n                        vis[j] = 1;\n                        q.push(ar[j]);\n                        cnt++;\n                    }\n                }\n            }\n        }\n        return cnt;\n    }\n    int maximumDetonation(vector<vector<int>>& ar) {\n        int n = ar.size();\n        long long int ans = -1;\n        \n        for(int i = 0; i < n; i++){\n            cnt = 0;\n            ans = max(ans, get(ar, i, n));\n        }\n        \n        return ans;\n    }\n};\n```\nDo Upvote, If it helps!
['Breadth-First Search']