id int64 1 3.58k | problem_description stringlengths 516 21.8k | instruction int64 0 3 | solution_c dict |
|---|---|---|---|
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 0 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n vector<vector<int>> bombsTriggered(bombs.size());\n vector<bool> exploded(bombs.size());\n int maxBombsExploded = 0;\n\n //Create neighbours graph if radius triggers a bomb\n for (int i=0... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 0 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n int nBombs = bombs.size();\n vector<int> adj[nBombs];\n generateAdjList(adj, bombs);\n\n int maxBombs = 0;\n for(int i=0; i<nBombs; i++) {\n vector<bool> visited(nBombs, false)... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 0 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n long long dd, x1,x2,y1,y2,n,ans=0;\n n=bombs.size();\n vector<int>adj[n];\n for(int i=0;i<n;i++){\n for(int j=i+1;j<n;j++){\n x1=bombs[i][0];\n x2=bombs[... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 1 | {
"code": "class Solution {\npublic:\n\n void dfs(vector<vector<int>>& al, vector<bool>& visited, int i, int& ans)\n {\n if(visited[i] == true)\n return;\n\n visited[i] = true;\n ans++;\n for(auto ele : al[i])\n dfs(al,visited,ele,ans);\n \n }\n int... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 1 | {
"code": "class Solution {\npublic:\n //vector<bool> detonated;\n vector<bool> checked;\n unordered_map<int, vector<int>> graph;\n int max_num = -1;\n int num;\n // void detonate(int i, vector<vector<int>> related_bombs){\n // for(int j = 0; j < related_bombs[i].size(); j++){\n // ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 1 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n map<int, vector<int>> adj;\n\n for(int i = 0; i < bombs.size(); i++) {\n auto b = bombs.at(i);\n int x1 = b[0];\n int y1 = b[1];\n long r = b[2];\n\n for... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 1 | {
"code": "typedef long long int ll;\nclass Solution {\npublic:\n vector<vector<int>>graph;\n int n;\n vector<int>vis;\n int cnt;\n\n void dfs(int node){\n if(vis[node]==1)return;\n vis[node]=1;\n cnt++;\n cout<<cnt<<\" \";\n for(auto neig:graph[node]){\n \n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 1 | {
"code": "#define intt double\n\n\n\n\n\nclass Solution {\npublic:\n int dfs(int node,vector<int>&vis,int &count,vector<int>adj[]){\n vis[node]=1;\n count++;\n for(auto it:adj[node]){\n if(vis[it]==0){\n dfs(it,vis,count,adj);\n }\n }\n... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 1 | {
"code": "class Solution {\npublic:\n\n void dfs(int node, vector<int> adj[], int& cnt, vector<int>& vis)\n {\n vis[node] = 1;\n cnt++;\n\n for(auto it: adj[node])\n {\n if(!vis[it])\n {\n dfs(it, adj, cnt, vis);\n }\n }\n }\... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 1 | {
"code": "class Solution {\npublic:\n vector<vector<int>> adj;\n\n double getDist(vector<int> &a, vector<int> &b) {\n double dx = a[0] - b[0], dy = a[1] - b[1];\n return sqrt(dx * dx + dy * dy);\n }\n\n int dfs(int x, vector<int> &vis) {\n vis[x] = 1;\n int ret = 1;\n f... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 1 | {
"code": "class Solution {\npublic:\n int dfs(vector<vector<int>>& graph,int i,vector<int>& vis){\n vis[i]=1;\n int c=1;\n for(auto j:graph[i]){\n if (!vis[j]) c+=dfs(graph,j,vis);\n }\n return c;\n }\n int maximumDetonation(vector<vector<int>>& bombs) {\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n\n long long dist(int x1,int y1,int x2,int y2){\n return (1ll*(x1-x2)*(x1-x2))+(1ll*(y1-y2)*(y1-y2));\n }\n\n int dfs(vector<int>&vis,vector<vector<int>>&adj,int ind){\n if(vis[ind]>0)return 0;\n vis[ind]=1;\n int ret=1;\n for(auto i:ad... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n const int n = bombs.size(); \n auto check = [&](int i, int j) -> bool {\n long x1 = bombs[i][0], y1 = bombs[i][1], r1 = bombs[i][2];\n long x2 = bombs[j][0], y2 = bombs[j][1], r2 = bombs[j][2];\n retu... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n void dfs(int node, unordered_map <int, vector<int>> &adj, vector<int> & visited, int &comp){\n visited[node]=1;\n comp++;\n cout<<comp;\n\n for(auto i:adj[node]){\n if(!visited[i]){\n dfs(i,adj,visited, comp);\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n double calcDis(int x1, int y1, int x2, int y2) {\n // Calculate Euclidean distance between two points (x1, y1) and (x2, y2)\n long double dis = sqrtl(1LL * (x1 - x2) * (x1 - x2) + 1LL * (y1 - y2) * (y1 - y2));\n return dis;\n }\n\n void dfs(int node... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n\n void dfs(unordered_map<int,list<int>>&adjList,vector<bool>&visited,int i,int& count){\n visited[i] = true;\n count++;\n\n for(auto it:adjList[i]){\n int index = it;\n if(!visited[index])\n dfs(adjList,visited,index,c... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n int n=bombs.size();\n int ans=0;\n for(int i=0;i<n;i++){\n queue<pair<int,int>> q;\n q.push({i,bombs[i][2]});\n vector<bool> f(n,false);\n f[i]=true;\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n bool touch(vector<int>& bomb1,vector<int>& bomb2){\n double cx = pow(double(abs(bomb1[0] - bomb2[0])),2);\n double cy = pow(double(abs(bomb1[1] - bomb2[1])),2);\n double d = pow(cx + cy,0.5);\n if(double(bomb1[2]) < d){\n return false;\... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n int n = bombs.size(), ans = 0, cnt = 0;\n vector<int> vis(n,0);\n for(int i = 0; i < n ; i++){\n cnt = 0;\n vector<int> vis(n,0);\n queue<int> q;\n q... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n \n int maximumDetonation(vector<vector<int>>& bombs) {\n \n unordered_map<int,vector<int>> mp;\n long long n = bombs.size();\n\n for(int i=0;i<n;i++){\n for(int j=0;j<n;j++){\n long long x = abs(bombs[i][0]-bombs[j][0]),... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n unordered_map<int,vector<int>> graph;\n \n for(int i = 0; i < bombs.size(); i++){\n int x0 = bombs[i][0];\n int y0 = bombs[i][1];\n int r0 = bombs[i][2];\n \n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n typedef long long ll;\n\n void areaCovered(int bomb, vector<ll>& visited, ll& area,\n vector<ll> adj[]) {\n visited[bomb] = 1;\n area += 1;\n for (auto neighbor : adj[bomb]) {\n if (!visited[neighbor])\n ar... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n\n bool checkRange(int i,int j,vector<vector<int>>&bombs)\n {\n //a bomb cannot detonante itself\n if(i==j) return false;\n\n long long xDis=bombs[i][0] - bombs[j][0];\n long long yDis=bombs[i][1] - bombs[j][1];\n long long radius=bombs[i]... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n long long int calcDist(long long int x1,long long int y1, long long int x2, long long int y2){\n long long x = abs(x1-x2);\n long long y = abs(y1-y2);\n long long res = x*x + y*y;\n cout<<res<<\"\\n\";\n return res;\n }\n\n void printG... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\n void dfs(int i,unordered_map<int,unordered_set<int>> &adj, vector<bool> &visited, int &count){\n if(visited[i]==0){\n visited[i] =1;\n count++;\n for(auto it: adj[i]){\n dfs(it,adj,visited,count);\n }\n }\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\nprivate:\n bool intersect(int x1,int y1, int r1, int x2, int y2, int r2){\n long long x=abs(x1-x2);\n long long y=abs(y1-y2);\n\n double dis=sqrt((x*x+y*y));\n\n if(dis<=double(r1)) {\n // cout<<x1<<\" \"<<y1<<\" \"<<x2<<\"x2\"<<y2<<\" dis\"<<dis<... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n if (bombs.size() == 1) {\n return 1;\n }\n \n const int n_bombs = bombs.size();\n \n // convert bombs into an adjacency map (graph)\n std::unordered_map<int, std:... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n long long n=bombs.size(),ans=0;\n vector<long long> graph[n];\n for(long long i=0;i<n;i++){\n for(long long j=0;j<n;j++){\n if(i==j) continue;\n long long x1,y1... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n unordered_map<int, vector<int>> graph;\n\n for(int i = 0; i < bombs.size(); i++){\n\n int x1 = bombs[i][0], y1 = bombs[i][1], radius1 = bombs[i][2];\n graph[i] = vector<int>();\n\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "#define ll long long\nclass Solution {\npublic:\n bool isInside(ll circle_x, ll circle_y, ll rad, ll x, ll y){\n if ((x - circle_x) * (x - circle_x) + (y - circle_y) * (y - circle_y) <= rad * rad) return true;\n else return false;\n }\n \n int bfs(int i, unordered_map<int,vector<i... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "#include <cmath>\n#include <vector>\n#include <queue>\n\nusing namespace std;\n\nclass Solution \n{\npublic:\n bool Check(const vector<int>& bomb1, const vector<int>& bomb2)\n {\n long long dx = bomb1[0] - bomb2[0];\n long long dy = bomb1[1] - bomb2[1];\n long long distance_squar... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n vector<vector<int>> edges(bombs.size());\n for (int i=0;i<bombs.size();i++)\n {\n for (int j=0;j<bombs.size();j++)\n {\n if (i == j)\n continue;\... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "#include <vector>\n#include <list>\n#include <queue>\n#include <cmath>\n#include <algorithm>\n\nusing namespace std;\n\nclass Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n // zh: 邻接表存储图\n // en: store graph using adjacency list\n list<int> graph[bombs.s... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n const int n = bombs.size(); \n auto check = [&](int i, int j) -> bool {\n long x1 = bombs[i][0], y1 = bombs[i][1], r1 = bombs[i][2];\n long x2 = bombs[j][0], y2 = bombs[j][1], r2 = bombs[j][2];\n retu... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n int n = size(bombs);\n auto sqr = [](int n) -> long long{\n return (long long)n * n;\n };\n vector<vector<int>> G(n);\n auto near = [&](int i, int j){\n // check if ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bs) {\n int res = 0, sz = bs.size();\n vector<vector<int>> al(bs.size());\n for (int i = 0; i < sz; ++i) {\n long long x = bs[i][0], y = bs[i][1], r2 = (long long)bs[i][2] * bs[i][2];\n for (int j = 0; j < bs.s... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\n double dist(int x1,int y1, int x2,int y2){\n double k = (double)(x1-x2)*(x1-x2) + (double)(y1-y2)*(y1-y2);\n return pow(k,0.5);\n }\n\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n unordered_map<int,set<int>> adj;\n for(int i=0;i<bom... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\n double dist(int x1,int y1, int x2,int y2){\n double k = (double)(x1-x2)*(x1-x2) + (double)(y1-y2)*(y1-y2);\n return pow(k,0.5);\n }\n\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n unordered_map<int,set<int>> adj;\n for(int i=0;i<bom... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n const size_t numBombs = bombs.size();\n int maxBombs = 1;\n unordered_map<int, unordered_set<int>> denotationMap;\n for (int i = 0; i < bombs.size(); ++i)\n {\n const auto& bom... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n\n int bfs(unordered_map<int, vector<int>>&adj, int node, vector<int>vis){\n queue<int>q;\n q.push(node);\n vis[node] = 1;\n int count = 0;\n while(!q.empty()){\n int top = q.front();\n q.pop();\n count+=1;\n\... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "\n\nclass Solution {\npublic:\n\ntypedef long long ll;\nvoid dfs(int node,vector<int>adj[],unordered_set<int>&vis){\n vis.insert(node);\n\n for(auto &adjNode:adj[node]){\n if(vis.find(adjNode)==vis.end()){\n dfs(adjNode,adj,vis);\n }\n }\n}\n int maximumDetonation(vecto... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\ntypedef long long LL;\nvoid dfs(int node , unordered_map<int , vector<int>>&adj \n, unordered_set<int>&vis){\nvis.insert(node);\nfor(auto v :adj[node]){\n if(vis.find(v) == vis.end()){\n dfs(v , adj , vis);\n }\n}\n}\n int maximumDetonation(vector<vector<int>>& ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 2 | {
"code": "class Solution {\npublic:\n\n void dfs(int u,unordered_set<int>&visited,unordered_map<int,vector<int>>&adj)\n {\n visited.insert(u);\n for(int &v:adj[u])\n {\n if(visited.find(v)==visited.end())\n {\n dfs(v,visited,adj);\n }\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n\n bool check(long long x,long long y,long long x1,long long y1,long long r){\n long long d1=x-x1;\n long long d2=y-y1;\n\n if(d1*d1+d2*d2<=r*r)\n return true;\n return false;\n }\n void join(vector <vector <int >> &arr,long long... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int dfs(unordered_map<int, vector<int>>& adj_list, unordered_map<int, bool>& detonated, int node) {\n if (detonated[node])\n return 0;\n\n int res = 1;\n detonated[node] = true;\n\n for (int neighbor : adj_list[node])\n res +=... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int maximumDetonation(const vector<vector<int>> &bombs) const {\n vector<pair<int, int>> edges;\n for (int bomb1 = 0; bomb1 < bombs.size() - 1; ++bomb1) {\n vector<int> b1 = bombs[bomb1];\n for (int bomb2 = bomb1 + 1; bomb2 < bombs.size(); ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n unordered_map<int, unordered_set<int>> graph;\n\n int maximumDetonation(vector<vector<int>>& bombs) {\n build_graph(bombs);\n \n int group_prefix = -1;\n int max_count = 0;\n for (int i=0; i<bombs.size(); i++) {\n group_prefix++;\n... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n set<int> detonated; // Use set<int> to track indices of detonated bombs\n int maxCount = 0;\n\n for (int i = 0; i < bombs.size(); i++) {\n if (detonated.find(i) != detonated.end()) continue;... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n set<int> detonated; // Use set<int> to track indices of detonated bombs\n int maxCount = 0;\n\n for (int i = 0; i < bombs.size(); i++) {\n if (detonated.find(i) != detonated.end()) continue;... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n set<int> detonated; // Use set<int> to track indices of detonated bombs\n int maxCount = 0;\n\n for (int i = 0; i < bombs.size(); i++) {\n if (detonated.find(i) != detonated.end()) continue;... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\nvoid dfs(int node ,unordered_map<int,bool> &visited,unordered_map<int , list<int>> &adj, int &cnt){\n visited[node] = 1;\n cnt++;\n for(auto i : adj[node]){\n if(!visited[i]){\n dfs(i,visited,adj,cnt);\n }\n }\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n unordered_map<int, vector<int>> graph;\n\n int maximumDetonation(vector<vector<int>>& bombs) {\n int n = bombs.size();\n\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (i != j) {\n int a = abs... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int n;\n void dfs(unordered_map<int,vector<int>> &mp,int i, unordered_set<int> &vis){\n \n vis.insert(i);\n for(auto neigh : mp[i]){\n if(vis.find(neigh) == vis.end()){\n dfs(mp,neigh,vis);\n }\n \n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n typedef long long LL;\n\n void dfs(int src,unordered_set<int>&vis,vector<int>graph[]){\n vis.insert(src);\n\n for(auto it:graph[src]){\n if(vis.find(it)!=vis.end())continue;\n\n dfs(it,vis,graph);\n }\n\n }\n int maxi... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\n int bfs (vector<vector<int>>& graph, int start) {\n unordered_set<int> visited;\n queue<int> q;\n q.push(start);\n visited.insert(start);\n int bCount = 0;\n while (!q.empty()) {\n int cur = q.front();\n q.pop();\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n\n int dfs(int node, vector< vector<int> >& adjList, unordered_set<int>& visited){\n\n if(visited.find(node) != visited.end()) return 0;\n\n visited.insert(node);\n for(auto neighbor: adjList[node]){\n dfs(neighbor, adjList, visited);\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "//this is max of component? WRONG, it's directed graph A can detonate B but B might not be able to detonate A like in example1\n\nclass Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n unordered_map<int, vector<int>> adj;\n for(int i=0;i<bombs.size();i++){\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n typedef long long ll;\n void dfs(int i,vector<int>adj[],set<int>&vis){\n vis.insert(i);\n for(auto it:adj[i]){\n if(!vis.count(it)){\n dfs(it,adj,vis);\n }\n }\n }\n int maximumDetonation(vector<vector<int>>& b) {\n int n=b.siz... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\n\n void dfs(int idx, auto& edges, auto& mset){\n\n if(mset.find(idx)!=mset.end())return ;\n mset.insert(idx);\n\n for(int nbr: edges[idx]){\n dfs(nbr, edges, mset);\n }\n\n return;\n }\n\npublic:\n int maximumDetonation(vector<vector<... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n\n void dfs(vector<vector<int>>& al, set<int>& visited, int i, int& ans)\n {\n if(visited.find(i) != visited.end())\n return;\n\n visited.insert(i);\n ans++;\n for(auto ele : al[i])\n dfs(al,visited,ele,ans);\n \n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\n double findDist(long x1,long y1,long x2,long y2)\n {\n return sqrt(double( (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2) ) );\n }\n\n vector<vector<int>>formAdj(vector<vector<int>>&bombs)\n {\n int n=bombs.size();\n vector<vector<int>>adj(n);\n for(int i=0;i<... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\n int dfs(int i, map<int, vector<int>>& m, set<int>& vis) {\n vis.insert(i);\n int count = 1;\n for (int neighbor : m[i]) {\n if (vis.find(neighbor) == vis.end()) {\n count += dfs(neighbor, m, vis);\n }\n }\n return... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n unordered_map<int, vector<int>> mp; \n for(int i = 0; i < bombs.size(); i++) { \n for(int j = 0; j < bombs.size(); j++) { \n \n int x1 = bombs[i][0], y1 = bombs[i][1],... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int maximumDetonation(const vector<vector<int>> &bombs) const {\n vector<pair<int, int>> edges;\n for (int bomb1 = 0; bomb1 < bombs.size() - 1; ++bomb1) {\n vector<int> b1 = bombs[bomb1];\n for (int bomb2 = bomb1 + 1; bomb2 < bombs.size(); ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n int n=bombs.size(),mx=0;\n for(int i=0;i<n;i++){\n mx=max(mx,find(bombs,i));\n }\n return mx;\n }\n int find(vector<vector<int>>&bombs,int i){\n queue<int>q;\n q.p... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\nprivate:\n bool isInRange(int radius, int x1, int y1, int x2, int y2) {\n // pythagorean theorem\n long range = static_cast<long>(radius)*radius;\n long xDistance = static_cast<long>(x1-x2)*(x1-x2);\n long yDistance = static_cast<long>(y1-y2)*(y1-y2);\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\nprivate:\n bool isInRange(int radius, int x1, int y1, int x2, int y2) {\n // pythagorean theorem\n long range = static_cast<long>(radius)*radius;\n long xDistance = static_cast<long>(x1-x2)*(x1-x2);\n long yDistance = static_cast<long>(y1-y2)*(y1-y2);\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n bool inside(vector<int> &b1, vector<int> &b2) {\n double r = b1[2];\n double x1 = b1[0], x2 = b2[0], y1 = b1[1], y2 = b2[1];\n\n double dist = sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));\n\n if (dist <= r) {\n return true;\n... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\nint countNomberOfCoveredBombs(unordered_map<int, vector<int>>& graph, vector<vector<int>>& bombs, int startIdx){\n\tint count = 0;\n\tqueue<int> nodeQueue;\n\tunordered_set<int> visited;\n\tnodeQueue.push(startIdx);\n\tvisited.insert(startIdx);\n\twhile(!nodeQueue.empty()){\n\t\t... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\nvoid addToHashMap(std::unordered_map<int, std::list<int>>& hashMap, int key, int value) {\n // Check if the key is present in the hashmap\n if (hashMap.count(key) > 0) {\n // Key is present, add the value to the existing list\n hashMap[key].push_back(value);\n... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n int n = bombs.size();\n int mx_den = 0;\n map <int, int> mp;\n\n for(int i=0; i<n; i++){\n vector <int> vis(n, 0);\n int cur_den = 1;\n queue<vector<int>> q;\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n int n = bombs.size();\n unordered_map<int, vector<int>> adj;\n\n for (int i = 0; i < n; i++) {\n for (int j = i + 1; j < n; j++) {\n long long x1 = bombs[i][0], y1 = bombs[i][... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\n int bfs (vector<vector<int>>& graph, int start) {\n unordered_set<int> visited;\n queue<int> q;\n q.push(start);\n visited.insert(start);\n int bCount = 0;\n while (!q.empty()) {\n int cur = q.front();\n q.pop();\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n typedef long long LL;\n int bfs(int u,unordered_map <int, vector<int>> &adj){\n unordered_set<int>vis;\n queue<int> que;\n que.push(u);\n vis.insert(u);\n while(!que.empty()){\n int temp = que.front();\n que.pop();\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n\n\n int bfs(unordered_map<int, vector<int>>& adj, int node){\n // vector<bool> vis(adj.size()+1,false);\n unordered_map<int, bool> vis;\n // vis[node]=true;\n vis[node] = true;\n queue<int> q;\n q.push(node);\n int count = 0;\n... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "// class Bomb{\n\n// public:\n// int x, int y, int r;\n \n// Bomb(int x, int y, int r){\n// this->x = x;\n// this->y = y;\n// this->r = r;\n// }\n// };\nclass Solution {\npublic:\n \n int bfs(int i, vector<int> &vis, vector<int> adj[]){\n queue<int> q;\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "// class Bomb{\n\n// public:\n// int x, int y, int r;\n \n// Bomb(int x, int y, int r){\n// this->x = x;\n// this->y = y;\n// this->r = r;\n// }\n// };\nclass Solution {\npublic:\n \n int bfs(int &i, vector<int> &vis, vector<int> adj[]){\n queue<int> q;\n... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "#include <iostream>\n#include <vector>\n#include <map>\n#include <queue>\n#include <algorithm>\n#include <cmath>\n\nusing namespace std;\n\nclass Solution {\npublic:\n int bfs(int node, map<int, vector<int>>& mp, map<int, bool>& isVisited) {\n queue<int> q;\n q.push(node);\n int cnt... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n double dis(int x1, int y1, int x2, int y2){\n return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));\n }\n\n int solve(vector<vector<int>>& bombs, int i, int n){\n vector<int> vis(n, 0);\n queue<int> q;\n q.push(i);\n int ans = 0;\n wh... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int fodega(vector<int> &v1,vector<int> &v2){\n long long a=v1[0]-v2[0];\n long long b=v1[1]-v2[1];\n if((a*a)+(b*b) <= pow((v1[2]),2)) {\n return 1;\n }\n return 0;\n }\n\n int bfs(int point, vector<vector<int>> &adj,unordered_map<int... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n unordered_map<int,list<int>> adj;\n int n=bombs.size();\n for(int i=0;i<n;i++){\n long long val=(long long)bombs[i][2]*bombs[i][2];\n for(int j=0;j<n;j++){\n if(i!=j... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n bool isInRange(vector<int>& bomb1,vector<int>& bomb2) {\n long long dx =bomb1[0]-bomb2[0];\n long long dy=bomb1[1]-bomb2[1];\n long long distanceSquared=dx*dx + dy*dy;\n long long radiusSquared =(long long)bomb1[2]*bomb1[2];\n return distanc... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n bool isInRange(vector<int>& bomb1,vector<int>& bomb2) {\n long long dx =bomb1[0]-bomb2[0];\n long long dy=bomb1[1]-bomb2[1];\n long long distanceSquared=dx*dx + dy*dy;\n long long radiusSquared =(long long)bomb1[2]*bomb1[2];\n return distanc... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n unordered_map<int, unordered_set<int>> graph;\n\n int maximumDetonation(vector<vector<int>>& bombs) {\n build_graph(bombs);\n \n int max_count = 0;\n for (int i=0; i<bombs.size(); i++) {\n int count = run_graph(bombs, i);\n max... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\n bool isInRange(pair<int,int> p1, pair<int,int>p2, double r)\n {\n double dis = (double)sqrt(pow(p1.first - p1.second, 2) + pow(p2.first - p2.second, 2));\n return dis <= r;\n }\n\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n unordered_m... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n int n = bombs.size();\n vector<vector<int>> map(n);\n for (int i = 0; i < n; i++) {\n for (int j = i + 1; j < n; j++) {\n auto bomb1 = bombs[i];\n auto bomb2 = ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n unordered_map<int, unordered_set<int>> graph;\n\n int maximumDetonation(vector<vector<int>>& bombs) {\n build_graph(bombs);\n \n int max_count = 0;\n for (int i=0; i<bombs.size(); i++) {\n int count = run_graph(bombs, i);\n max... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n vector<vector<int>> bombsarr;\n unordered_set<int> seen;\n unordered_map<int,vector<int>> graph;\n int maximumDetonation(vector<vector<int>>& bombs) {\n bombsarr = bombs;\n int result = 0;\n\n for(int i=0;i<bombsarr.size();i++){\n vect... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n vector<vector<int>> bombsarr;\n unordered_set<int> seen;\n unordered_map<int,vector<int>> graph;\n int maximumDetonation(vector<vector<int>>& bombs) {\n bombsarr = bombs;\n int result = 0;\n\n for(int i=0;i<bombsarr.size();i++){\n vect... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\n long long distance(long long x1,long long y1,long long x2,long long y2){\n return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);\n }\n int dfs(vector<vector<int>>&bombs,int i,map<int,bool>&visited){\n int curr_ans=1;\n \n for(int j=0;j<bombs.size();j++){\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\nint maximumDetonation(std::vector<std::vector<int>>& bombs)\n{\n int maximum = 1;\n for (int i = 0; i < bombs.size(); ++i)\n maximum = std::max(maximum, bfs_bomb(bombs, i));\n return maximum;\n}\n\nint bfs_bomb(const std::vector<std::vector<int>>& bombs, int start... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\nint bfs(int node,vector<vector<int>>& bombs)\n{\n queue<vector<int>> qu;\n int n = bombs.size();\n qu.push(bombs[node]);\n vector<int> visited(n,0);\n visited[node]=1;\n int count =1;\n while(!qu.empty())\n {\n vector<int> temp = qu.front();\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n \n int maxBombsExploded = 1; // always detonate at least 1 bomb\n \n // map storing, for each bomb i, the bombs j that it can detonate\n unordered_map<int, unordered_set<int>> r... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n \n int maxBombsExploded = 1; // always detonate at least 1 bomb\n \n // map storing, for each bomb i, the bombs j that it can detonate\n unordered_map<int, unordered_set<int>> r... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\n bool isInRange(pair<int,int> p1, pair<int,int>p2, double r)\n {\n double dis = (double)sqrt(pow(p1.first - p1.second, 2) + pow(p2.first - p2.second, 2));\n return dis <= r;\n }\n\npublic:\n int maximumDetonation(vector<vector<int>>& bombs) {\n unordered_m... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n\n vector<vector<int>> g;\n vector<int> vis;\n int n;\n int compsz;\n\n void dfs(int node){\n vis[node] = 1;\n compsz++;\n for(auto v: g[node]){\n if(!vis[v]) dfs(v);\n }\n }\n\n int maximumDetonation(vector<vector<int>>... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n vector<vector<int>> adj;\n vector<bool> vis;\n int cc;\n void dfs(int node) {\n vis[node] = true;\n cc++;\n for(auto x: adj[node]) {\n if(!vis[x]) {\n dfs(x);\n }\n }\n }\n int maximumDetonation(v... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n bool canDetonate(vector<int> bombA, vector<int> bombB) {\n long long xA = bombA[0];\n long long yA = bombA[1];\n long long rA = bombA[2];\n\n long long xB = bombB[0];\n long long yB = bombB[1];\n\n long long distance = (xA - xB) * (xA... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\n using EdgeMapT = unordered_map<int, vector<int>>;\n using VisitT = vector<bool>;\n bool inRange(auto bombI, auto bombJ) {\n long long xDist = bombI[0] - bombJ[0];\n long long yDist = bombI[1] - bombJ[1];\n long long distSq = xDist * xDist + yDist * yDist;\n ... |
2,206 | <p>You are given a list of bombs. The <strong>range</strong> of a bomb is defined as the area where its effect can be felt. This area is in the shape of a <strong>circle</strong> with the center as the location of the bomb.</p>
<p>The bombs are represented by a <strong>0-indexed</strong> 2D integer array <code>bombs</... | 3 | {
"code": "class Solution {\npublic:\n bool isPointInCircle(vector<int> circle, vector<int> point) {\n long x1 = circle[0];\n long y1 = circle[1];\n long x2 = point[0];\n long y2 = point[1];\n long radius = circle[2];\n\n long long d = (x2 - x1) * (x2 - x1) + (y2 - y1) * (... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.