question_slug
stringlengths
3
77
title
stringlengths
1
183
slug
stringlengths
12
45
summary
stringlengths
1
160
author
stringlengths
2
30
certification
stringclasses
2 values
created_at
stringdate
2013-10-25 17:32:12
2025-04-12 09:38:24
updated_at
stringdate
2013-10-25 17:32:12
2025-04-12 09:38:24
hit_count
int64
0
10.6M
has_video
bool
2 classes
content
stringlengths
4
576k
upvotes
int64
0
11.5k
downvotes
int64
0
358
tags
stringlengths
2
193
comments
int64
0
2.56k
detonate-the-maximum-bombs
JavaScript - DFS Solution
javascript-dfs-solution-by-harsh07bharva-fwbu
\n/**\n * @param {number[][]} bombs\n * @return {number}\n */\nvar maximumDetonation = function(bombs) {\n if(bombs.length <= 1) return bombs.length;\n \n
harsh07bharvada
NORMAL
2021-12-21T04:25:29.956323+00:00
2021-12-21T04:25:29.956359+00:00
1,161
false
```\n/**\n * @param {number[][]} bombs\n * @return {number}\n */\nvar maximumDetonation = function(bombs) {\n if(bombs.length <= 1) return bombs.length;\n \n let adj = {}, maxSize = 0;\n const checkIfInsideRange = (x, y, center_x, center_y, radius) =>{\n return ( (x-center_x)**2 + (y-center_y)**2 <= ...
6
0
['Depth-First Search', 'JavaScript']
0
detonate-the-maximum-bombs
✅ [c++] || BFS
c-bfs-by-xor09-m5ui
\n#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)
xor09
NORMAL
2021-12-17T14:31:16.141895+00:00
2021-12-17T14:31:16.141922+00:00
541
false
```\n#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<int>> &ma...
6
0
['Breadth-First Search', 'Graph', 'C', 'C++']
0
detonate-the-maximum-bombs
Easy Math and Graph Solution || C++
easy-math-and-graph-solution-c-by-abhi_p-dvob
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
abhi_pandit_18
NORMAL
2023-06-02T16:36:21.876764+00:00
2023-06-02T16:36:21.876801+00:00
50
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
5
0
['C++']
0
detonate-the-maximum-bombs
Detonate Maximum Bombs, C++ Explained Solution
detonate-maximum-bombs-c-explained-solut-8uw3
The problem here can be solved in 2 ways. Using BFS or DFS. We have discussed BFS here because it can reduce down the code needed in DFS to form the graph first
ShuklaAmit1311
NORMAL
2022-07-15T09:07:23.021802+00:00
2022-07-15T09:07:23.021844+00:00
659
false
The problem here can be solved in 2 ways. Using **BFS** or **DFS**. We have discussed BFS here because it can reduce down the code needed in DFS to form the graph first. Basically if you see, we have been given a **DIRECTED GRAPH**. Note : **The graph might not be a DAG (Directed Acyclic Graph) cause it might be possib...
5
0
['Depth-First Search', 'Breadth-First Search', 'Graph', 'C']
2
detonate-the-maximum-bombs
Video solution | Intuition explained in detail | C++ | BFS | Hindi
video-solution-intuition-explained-in-de-0amh
Video\nHey everyone i have created a video solution for this problem (its in hindi), it involves intuitive explanation with code, this video is part of my playl
_code_concepts_
NORMAL
2024-10-30T09:51:04.944331+00:00
2024-10-30T09:59:21.627138+00:00
339
false
# Video\nHey everyone i have created a video solution for this problem (its in hindi), it involves intuitive explanation with code, this video is part of my playlist "Master Graphs"\nVideo link : https://youtu.be/hkD8JUuWbkA\nPlaylist link: : https://www.youtube.com/playlist?list=PLICVjZ3X1AcZ5c2oXYABLHlswC_1LhelY\n\n\...
4
0
['C++']
0
detonate-the-maximum-bombs
EASY 5 POINTER APPROACH || BFS || GRAPH
easy-5-pointer-approach-bfs-graph-by-abh-dh6d
Intuition\n Describe your first thoughts on how to solve this problem. \nThe algorithm aims to find the maximum number of bombs that can be detonated by choosin
Abhishekkant135
NORMAL
2023-12-13T01:06:34.481714+00:00
2023-12-13T01:06:34.481735+00:00
214
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe algorithm aims to find the maximum number of bombs that can be detonated by choosing only one bomb and triggering its chain reaction.\nBFS is an option to solve this problem as in this case we gotta travel from ont to another bomb and...
4
0
['Breadth-First Search', 'Graph', 'Java']
0
detonate-the-maximum-bombs
C# | BFS | Detailed Explanation + Dry Run | Runtime Beats 87.47%
c-bfs-detailed-explanation-dry-run-runti-nld6
Intuition\nWhile reading the problem we get to understand that this is a sort of problem where a relationship needs to be established between bombs so that when
anaken
NORMAL
2023-07-15T07:43:33.122914+00:00
2023-07-15T08:58:28.354843+00:00
114
false
# Intuition\nWhile reading the problem we get to understand that this is a sort of problem where a relationship needs to be established between bombs so that when one explodes the other one does too. This becomes more clearer by the fact that the range is involved while deciding that. So with this information it become...
4
0
['Breadth-First Search', 'Graph', 'C#']
1
detonate-the-maximum-bombs
short and sweet JS solution using BFS
short-and-sweet-js-solution-using-bfs-by-8k9m
Intuition\nA new bomb explodes if its distance to the current bomb is less than the radius of the current bomb. \nWe can calculate this with a^2 + b^2 = c^2\nWe
Mister_CK
NORMAL
2023-06-02T20:54:38.173274+00:00
2024-04-07T21:00:42.686510+00:00
335
false
# Intuition\nA new bomb explodes if its distance to the current bomb is less than the radius of the current bomb. \nWe can calculate this with a^2 + b^2 = c^2\nWe can use BFS to check which bombs explodes, by adding exploding boms to our queue. \nWe have to check what the maximum number of exploding bombs is for each s...
4
0
['JavaScript']
3
detonate-the-maximum-bombs
Video Explanation - Math to Graph to DFS clear explanation [Java]
video-explanation-math-to-graph-to-dfs-c-9ljo
Approach\nhttps://youtu.be/hTqokf-HCqg\n\n# Similar Problems:\n\n- 463. Island Perimeter\n- 657. Robot Return to Origin\n- 200. Number of Islands\n- Number of I
hridoy100
NORMAL
2023-06-02T18:51:32.914083+00:00
2023-06-02T19:46:02.602271+00:00
978
false
# Approach\nhttps://youtu.be/hTqokf-HCqg\n\n# Similar Problems:\n\n- [463. Island Perimeter](https://leetcode.com/problems/island-perimeter/)\n- [657. Robot Return to Origin](https://leetcode.com/problems/robot-return-to-origin/)\n- [200. Number of Islands](https://leetcode.com/problems/number-of-islands/)\n- [Number o...
4
0
['Depth-First Search', 'Java']
1
detonate-the-maximum-bombs
BFS SOLUTION
bfs-solution-by-abhai0306-zm3i
\nclass Pair\n{\n int x,y,r;\n Pair(int x,int y,int r)\n {\n this.x = x;\n this.y = y;\n this.r = r;\n }\n}\n\nclass Solution \
abhai0306
NORMAL
2023-06-02T03:06:38.285391+00:00
2023-06-02T03:06:38.285436+00:00
61
false
```\nclass Pair\n{\n int x,y,r;\n Pair(int x,int y,int r)\n {\n this.x = x;\n this.y = y;\n this.r = r;\n }\n}\n\nclass Solution \n{\n int max = 1 ,ans = 1;\n public int maximumDetonation(int[][] bombs) \n {\n \n for(int i=0;i<bombs.length;i++)\n {\n ...
4
0
['Breadth-First Search', 'Java']
0
detonate-the-maximum-bombs
C++ Easy to understand DFS solution
c-easy-to-understand-dfs-solution-by-jay-f0b3
Intuition\nWe select a bomb Bi to detonate first and then look for other bombs in range (let\'s say it is Bj), it form\'s a graph i.e, there exist a directed ed
jayantsaini0007
NORMAL
2023-02-15T14:43:50.472772+00:00
2023-02-15T14:43:50.472814+00:00
1,552
false
# Intuition\nWe select a bomb Bi to detonate first and then look for other bombs in range (let\'s say it is Bj), it form\'s a graph i.e, there exist a directed edge between bomb Bi and Bj and so on. Thus, DFS can be applied on each and every bomb in our array and max result can be checked after completion of each DFS.\...
4
0
['Graph', 'C++']
0
detonate-the-maximum-bombs
Python BFS Faster than 96%
python-bfs-faster-than-96-by-welz-vjb7
Create a dictionary: the key is the index of each bomb, value is the indexes of all the bombs which the key bomb could detonate;\n2. Use BFS to calculate the nu
welz
NORMAL
2021-12-24T03:57:52.115787+00:00
2021-12-24T03:57:52.115814+00:00
814
false
1. Create a dictionary: the key is the index of each bomb, value is the indexes of all the bombs which the key bomb could detonate;\n2. Use BFS to calculate the number of bombs \n3. **No need to loop for all the keys in the dictionary,** for example:\nif bombs[3] can detonate bombs[4], bombs[5], bombs[6], so there is n...
4
0
['Breadth-First Search', 'Python']
1
detonate-the-maximum-bombs
Simple Java DFS [Faster than 90%]
simple-java-dfs-faster-than-90-by-here-c-qel7
Here is a brute force solution. TC might be improved. \n\nThis below snippet code improves the runtime to 90%\n\n\nif(k == bombs.length){ //improves runtime.\n
here-comes-the-g
NORMAL
2021-12-11T16:49:58.928247+00:00
2022-01-10T07:45:58.127174+00:00
429
false
Here is a brute force solution. TC might be improved. \n\nThis below snippet code improves the runtime to 90%\n\n```\nif(k == bombs.length){ //improves runtime.\n return k;\n }\n```\n\n```\nclass Solution {\n Map<Integer, List<Integer>> map = new HashMap<>();\n public int maximumDetonation(int[][] bombs) {\n ...
4
0
[]
0
detonate-the-maximum-bombs
Simple py code explained in detail! || BFS
simple-py-code-explained-in-detail-bfs-b-70cd
Problem Understanding\n\n- This is one of my favourite Math,geometry problem.Let\'s undersatnd the question!\n- They have given a list of list named bombs.It c
arjunprabhakar1910
NORMAL
2024-11-05T13:18:42.670605+00:00
2024-11-05T13:18:42.670642+00:00
335
false
# Problem Understanding\n\n- This is one of my favourite Math,geometry problem.Let\'s undersatnd the question!\n- They have given a *list of list* named `bombs`.It contains it\'s location and radius as `[x,y,r]`.\n- We can detonate any bomb,and find the `maximum` number of bombs which will be detonated.\n- A `bomb` is...
3
0
['Array', 'Math', 'Breadth-First Search', 'Graph', 'Geometry', 'Python3']
0
detonate-the-maximum-bombs
explaination for why union find not working
explaination-for-why-union-find-not-work-poel
Detonation condition is NOT intersection\n2. 1. BUT intersection should include co-ordinate of other bomb range\n2. UNION FIND WILL GIVE FALSE ANSWER FOR BELOW
youngsam
NORMAL
2024-03-26T01:48:55.540321+00:00
2024-03-26T01:48:55.540367+00:00
51
false
**Detonation condition is NOT intersection\n2. 1. BUT intersection should include co-ordinate of other bomb range\n2. UNION FIND WILL GIVE FALSE ANSWER FOR BELOW CASE**\ngiven A(0,0,5) B (4,0,1) C)(9,0,5)\n\n![image](https://assets.leetcode.com/users/images/d918d62e-b7ff-43e7-be94-2ee3a2f84c7c_1711417630.7414768.png)\...
3
0
['Breadth-First Search', 'Graph']
0
detonate-the-maximum-bombs
Java | BFS | Beats > 99.7% | With Comments
java-bfs-beats-997-with-comments-by-thar-h5x7
Intuition\n Describe your first thoughts on how to solve this problem. \nWe systematically explore each bomb and its surrounding bombs to determine the maximum
tharunstk2003
NORMAL
2023-06-03T03:25:25.967716+00:00
2023-06-03T03:25:25.967754+00:00
617
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe systematically explore each bomb and its surrounding bombs to determine the maximum number of bombs that can be detonated from each starting point. By performing BFS, we ensure that we consider all reachable bombs and maximize the coun...
3
0
['Breadth-First Search', 'Java']
2
detonate-the-maximum-bombs
An Easy DFS solution approach || C++
an-easy-dfs-solution-approach-c-by-sazzy-g8zv
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
sazzysaturn
NORMAL
2023-06-02T19:25:28.941478+00:00
2023-06-02T19:25:28.941515+00:00
304
false
# 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 ...
3
0
['Array', 'Depth-First Search', 'Breadth-First Search', 'C++']
0
detonate-the-maximum-bombs
Solution in C++
solution-in-c-by-ashish_madhup-hrsn
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
ashish_madhup
NORMAL
2023-06-02T15:25:25.508009+00:00
2023-06-02T15:25:25.508053+00:00
41
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
3
0
['C++']
0
detonate-the-maximum-bombs
✅ 🔥 Python3 || ⚡easy solution
python3-easy-solution-by-maary-ckyy
Code\n\nfrom typing import List\nimport collections\n\nclass Solution:\n def maximumDetonation(self, bombs: List[List[int]]) -> int:\n n2nxt = collect
maary_
NORMAL
2023-06-02T14:42:53.671752+00:00
2023-06-02T14:42:53.671793+00:00
1,237
false
# Code\n```\nfrom typing import List\nimport collections\n\nclass Solution:\n def maximumDetonation(self, bombs: List[List[int]]) -> int:\n n2nxt = collections.defaultdict(set)\n lb = len(bombs)\n\n for i in range(lb): # i is the source\n xi, yi, ri = bombs[i]\n\n for j in...
3
0
['Python3']
0
detonate-the-maximum-bombs
C++ || EASY TO UNDERSTAND || DFS
c-easy-to-understand-dfs-by-chicken_rice-nld2
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
chicken_rice
NORMAL
2023-06-02T10:52:57.338694+00:00
2023-06-02T10:52:57.338736+00:00
255
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
3
0
['C++']
1
detonate-the-maximum-bombs
🏆 Detailed Explanation 🏆 ( DFS ) with time and space complexity analysis.
detailed-explanation-dfs-with-time-and-s-l8pz
Approach\n Describe your approach to solving the problem. \nBasic idea is to solve this problem is we are considering n bombs from 0 to n-1. We treat this indiv
malav_mevada
NORMAL
2023-06-02T10:43:37.002326+00:00
2023-06-02T10:43:37.002368+00:00
619
false
# Approach\n<!-- Describe your approach to solving the problem. -->\nBasic idea is to solve this problem is we are considering n bombs from 0 to n-1. We treat this individuals bomb as node in the graph. If a bomb can reach to the other bombs it means if bomb radius can cover any other bomb then there should be directed...
3
0
['Array', 'Math', 'Depth-First Search', 'Graph', 'Java']
3
detonate-the-maximum-bombs
Simple solution using Java : DFS
simple-solution-using-java-dfs-by-niketh-7yfi
The algorithm is pretty simple \n- First of all you need to create a graph such that it stores the bombs which are located in its range. We have the radius of t
niketh_1234
NORMAL
2023-06-02T08:31:11.295761+00:00
2023-06-02T08:31:11.295801+00:00
295
false
# The algorithm is pretty simple \n- First of all you need to create a graph such that it stores the bombs which are located in its range. We have the radius of the bomb and we run a for loop iterating over all the bombs calculate the distance between the two bombs and compare with the radius then we will able to decid...
3
0
['Depth-First Search', 'Breadth-First Search', 'Graph', 'C++', 'Java']
0
detonate-the-maximum-bombs
Detonate the Maximum Bombs | Optimized Solution | Daily Leetcode Challenge
detonate-the-maximum-bombs-optimized-sol-z4wf
\nclass Solution {\npublic:\n // Helper function to calculate distance between two points\n int distance(int x, int y, int x1, int y1)\n {\n dou
aditigulati
NORMAL
2023-06-02T08:29:20.859177+00:00
2023-06-02T08:29:20.859218+00:00
39
false
```\nclass Solution {\npublic:\n // Helper function to calculate distance between two points\n int distance(int x, int y, int x1, int y1)\n {\n double temp = sqrt(pow(x1 - x, 2) + pow(y1 - y, 2)); // Euclidean distance formula\n return ceil(temp); // Round up the distance to the nearest integer...
3
0
['Depth-First Search', 'C']
0
detonate-the-maximum-bombs
C++ DFS/BFS solutions with detonating bomb process beating 90.22%
c-dfsbfs-solutions-with-detonating-bomb-7ksgn
Intuition\n Describe your first thoughts on how to solve this problem. \nThe crucial part is to create the directed graph, i.e. the adjacent list. The bombs are
anwendeng
NORMAL
2023-06-02T07:05:30.247953+00:00
2023-06-04T11:22:00.695507+00:00
2,381
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe crucial part is to create the directed graph, i.e. the adjacent list. The bombs are the the vertice. If bomb[j] is within the bomb range of bomb[i], there is a directed edge from bomb[i] to bomb[j]. Then either of DFS or BFS can be ap...
3
0
['Depth-First Search', 'Breadth-First Search', 'Graph', 'Geometry', 'C++']
1
detonate-the-maximum-bombs
C++ solution using DFS
c-solution-using-dfs-by-piyusharmap-vxyv
Complexity\n- Time complexity:\nO(n^3)\n\n- Space complexity:\nO(n^2)to store the graph + O(n)for dfs recursion stack\n\n# Code\n\n class Solution {\npublic:\n
piyusharmap
NORMAL
2023-06-02T05:21:51.679546+00:00
2023-06-02T05:23:58.969375+00:00
1,288
false
# Complexity\n- Time complexity:\nO(n^3)\n\n- Space complexity:\nO(n^2)to store the graph + O(n)for dfs recursion stack\n\n# Code\n```\n class Solution {\npublic:\n //general dfs algorithm to find all the connected bombs (you can use bfs as well)\n void dfs(int node, vector<int> &visited, vector<int> adj[], int &...
3
0
['Array', 'Math', 'Depth-First Search', 'Graph', 'C++']
1
detonate-the-maximum-bombs
[ C++ ] [ DFS ]
c-dfs-by-sosuke23-k6qn
Code\n\nstruct Solution {\n int maximumDetonation(vector<vector<int>>& a) {\n int n = (int) a.size();\n vector<vector<int>> g(n);\n for
Sosuke23
NORMAL
2023-06-02T04:44:59.847963+00:00
2023-06-02T04:44:59.848020+00:00
1,918
false
# Code\n```\nstruct Solution {\n int maximumDetonation(vector<vector<int>>& a) {\n int n = (int) a.size();\n vector<vector<int>> g(n);\n for (int i = 0; i < n; i++) {\n for (int j = 0; j < n; j++) {\n if (i == j) {\n continue;\n }\n ...
3
0
['Depth-First Search', 'C++']
0
detonate-the-maximum-bombs
Python3 Solution
python3-solution-by-motaharozzaman1996-v8zp
\n\nclass Solution:\n def maximumDetonation(self, bombs: List[List[int]]) -> int:\n graph = [[] for _ in bombs]\n for i, (xi, yi, ri) in enumer
Motaharozzaman1996
NORMAL
2023-06-02T02:25:35.205618+00:00
2023-06-02T02:25:35.205667+00:00
1,377
false
\n```\nclass Solution:\n def maximumDetonation(self, bombs: List[List[int]]) -> int:\n graph = [[] for _ in bombs]\n for i, (xi, yi, ri) in enumerate(bombs): \n for j, (xj, yj, rj) in enumerate(bombs): \n if i < j: \n dist2 = (xi-xj)**2 + (yi-yj)**2\n ...
3
0
['Python', 'Python3']
0
detonate-the-maximum-bombs
EASY TO UNDERSTAND | C++ | DFS
easy-to-understand-c-dfs-by-romegenix-3nvo
\n\nclass Solution {\npublic:\n int cnt = 0;\n void dfs(vector<int> adj[], vector<int>& v, int i){\n cnt++;\n v[i] = 1;\n for(int x:
romegenix
NORMAL
2023-06-02T00:38:43.300977+00:00
2023-06-02T00:39:37.392516+00:00
378
false
\n```\nclass Solution {\npublic:\n int cnt = 0;\n void dfs(vector<int> adj[], vector<int>& v, int i){\n cnt++;\n v[i] = 1;\n for(int x: adj[i])\n if(!v[x])\n dfs(adj, v, x);\n }\n void makeAdjList(vector<vector<int>>& b, vector<int> adj[]){\n for(int i =...
3
0
['Depth-First Search', 'Graph', 'C++']
0
detonate-the-maximum-bombs
C++,BFS Easy to Understand.
cbfs-easy-to-understand-by-bnb_2001-khov
Approach:-For Every Bomb We will Check how many others Bombs Lies inside it and how many Bombs lies inside the bomb which Lies inside Checking Bomb and this wil
bnb_2001
NORMAL
2022-05-04T06:06:56.319634+00:00
2022-05-04T06:06:56.319660+00:00
167
false
**Approach**:-For Every Bomb We will Check how many others Bombs Lies inside it and how many Bombs lies inside the bomb which Lies inside Checking Bomb and this will Go on.\n-->This will be done with the help of **BFS.**\n-->We will return the bomb which will cover Maximum number of Bombs..\n```\n#define ll long long i...
3
0
['Breadth-First Search']
0
detonate-the-maximum-bombs
Easy c++ solution || DFS
easy-c-solution-dfs-by-thanoschild-jyfc
\nclass Solution {\npublic:\n void dfs(int i, int &count, vector<bool> &visited, vector<vector<int>> &adj){\n visited[i] = true;\n count++;\n
thanoschild
NORMAL
2022-02-13T04:37:24.145672+00:00
2022-02-13T04:37:24.145714+00:00
375
false
```\nclass Solution {\npublic:\n void dfs(int i, int &count, vector<bool> &visited, vector<vector<int>> &adj){\n visited[i] = true;\n count++;\n for(auto it : adj[i])\n {\n if(!visited[it])\n dfs(it, count, visited, adj);\n }\n }\n int maximumDetonation(...
3
0
['Depth-First Search', 'Graph', 'C']
0
detonate-the-maximum-bombs
Union Find 146 / 160 test cases passed. Why?
union-find-146-160-test-cases-passed-why-683a
Any buddy give me some advise? Why Union Find does\'t work!\n\n\nclass Union:\n def __init__ (self,n):\n self.root = [i for i in range(n)]\n se
AndrewHou
NORMAL
2021-12-12T22:56:11.506873+00:00
2021-12-12T22:56:11.506903+00:00
947
false
Any buddy give me some advise? Why Union Find does\'t work!\n```\n\nclass Union:\n def __init__ (self,n):\n self.root = [i for i in range(n)]\n self.rank = [1 for i in range(n)]\n self.count = n\n \n def union(self,x,y):\n rootX = self.find(x)\n rootY = self.find(y)\n...
3
0
['Union Find']
2
detonate-the-maximum-bombs
c++(28ms 100%) Hamilton path with BFS
c28ms-100-hamilton-path-with-bfs-by-zx00-7rbr
Runtime: 28 ms, faster than 100.00% of C++ online submissions for Detonate the Maximum Bombs.\nMemory Usage: 20.4 MB, less than 53.85% of C++ online submissions
zx007pi
NORMAL
2021-12-12T07:21:40.505602+00:00
2021-12-12T07:28:53.961417+00:00
145
false
Runtime: 28 ms, faster than 100.00% of C++ online submissions for Detonate the Maximum Bombs.\nMemory Usage: 20.4 MB, less than 53.85% of C++ online submissions for Detonate the Maximum Bombs.\n```\nclass Solution {\npublic:\n int maximumDetonation(vector<vector<int>>& b) {\n int n = b.size(), answer = 1;\n vect...
3
0
['C', 'C++']
0
detonate-the-maximum-bombs
JavaScript simple BFS explained
javascript-simple-bfs-explained-by-svolk-1d85
For every bomb we build a list of bombs that will detonate if current bomb will detonante.\nStart dfs for every bomb and count how many bombs will finally deton
svolkovichs
NORMAL
2021-12-11T18:29:20.456453+00:00
2021-12-12T10:46:44.066698+00:00
382
false
For every bomb we build a list of bombs that will detonate if current bomb will detonante.\nStart dfs for every bomb and count how many bombs will finally detonate if current bomb will detonate first.\nStore the max achived number of bombs.\n```\nvar maximumDetonation = function(bombs) {\n const n = bombs.length\n ...
3
0
['Breadth-First Search', 'JavaScript']
0
detonate-the-maximum-bombs
[C++] Graph | Thought Process
c-graph-thought-process-by-user1908v-ti9c
Thought Process in Brief: \n\nI thought about the relation between any two bombs. It appeared every (bomb1,bom2) pair can be represented with true/false. i.e do
user1908v
NORMAL
2021-12-11T16:53:57.891341+00:00
2021-12-11T17:27:50.468471+00:00
355
false
Thought Process in Brief: \n\nI thought about the relation between any two bombs. It appeared every (bomb1,bom2) pair can be represented with true/false. i.e does triggering bomb2 triggers bomb1? So I created a matrix with **(i,j)==true**, if: **j**th bomb triggers **i**th bomb\n\nI thought about triggering every one o...
3
0
['Depth-First Search', 'Graph']
1
detonate-the-maximum-bombs
BFS, C++
bfs-c-by-1mknown-hqos
First make a graph in such a way that there will be a directed edge from u to v if and only if the distance between u and v is less than or equal to the radius
1mknown
NORMAL
2021-12-11T16:14:38.437935+00:00
2021-12-11T16:23:05.381945+00:00
325
false
First make a graph in such a way that there will be a directed edge from u to v if and only if the distance between u and v is less than or equal to the radius of u.\n\nThen do Bfs one by one from each bomb and find the maximum ans.\n\ncode:\n```\nint maximumDetonation(vector<vector<int>>& nums) {\n vector<vect...
3
0
['Breadth-First Search', 'C']
0
detonate-the-maximum-bombs
Optimal DFS (Detailed Explanation) | 27ms
optimal-dfs-detailed-explanation-27ms-by-5n0z
Explanation\nThis problem can be approached from the perspective of the bombs being associated with each other in a directed manner (i.e. for a pair of bombs i
ttaylor27
NORMAL
2023-11-29T21:21:51.332070+00:00
2023-12-19T20:36:49.350428+00:00
353
false
# Explanation\nThis problem can be approached from the perspective of the bombs being associated with each other in a directed manner (i.e. for a pair of bombs `i` and `j`, there can be a case where bomb `i` can blow up bomb `j`, but bomb `j` cannot blow up bomb `i`, and vice versa). Because of this, the bombs have a 1...
2
0
['Depth-First Search', 'C++']
0
detonate-the-maximum-bombs
[python] Union find *can* work but not in the way your thinking
python-union-find-can-work-but-not-in-th-mjqf
Intuition\nIn order to understand the following I assume you have a strong grasp of union find and the default solution to this problem. \n\nWhy doesnt vanilla
ada8
NORMAL
2023-10-25T00:19:22.739821+00:00
2023-10-29T00:20:33.128578+00:00
214
false
# Intuition\nIn order to understand the following I assume you have a strong grasp of union find and the default solution to this problem. \n\nWhy doesnt vanilla union find work here? Because edges can be directional or bidirectional in this problem. \ni.e If the graph had all bi-directional edges union find would work...
2
0
['Union Find', 'Graph', 'Biconnected Component', 'Strongly Connected Component', 'Python3']
1
detonate-the-maximum-bombs
C++ Simple DFS Solution
c-simple-dfs-solution-by-h_wan8h-e1ab
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n\n\n# Code\n\nclass S
h_WaN8H_
NORMAL
2023-09-06T04:49:54.939690+00:00
2023-09-06T04:49:54.939709+00:00
9
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n\n\n# Code\n```\nclass Solution {\npublic:\n void dfs (unordered_map<int,vector<int>>&adj, int u, vector<bool>&visited, int &ans){\n\n visited[u]=true;\n ...
2
0
['Math', 'Depth-First Search', 'Graph', 'Geometry', 'C++']
0
detonate-the-maximum-bombs
VERY Intuitive SOLUTION!! AMAZING DSA CONCEPTS USED!!! MUST SEE!!!
very-intuitive-solution-amazing-dsa-conc-4lx8
This question deserves more attention as it is one of the most beautiful problems I\'ve seen! Absolute JOY !!\n# Intuition\n Describe your first thoughts on how
iamsuteerth
NORMAL
2023-06-13T20:38:56.519307+00:00
2023-06-13T20:38:56.519323+00:00
55
false
## This question deserves more attention as it is one of the most beautiful problems I\'ve seen! Absolute JOY !!\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nNow, the biggest question in anyone\'s mind when they first see this question is "How is this a graph\'s question"? And that...
2
0
['Array', 'Math', 'Depth-First Search', 'Graph', 'C++']
0
detonate-the-maximum-bombs
Easy to understand, Straight forward C++ solution || DFS ✈️✈️✈️✈️✈️✈️✈️
easy-to-understand-straight-forward-c-so-xk2r
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
ajay_1134
NORMAL
2023-06-07T08:26:02.436663+00:00
2023-06-07T08:26:02.436715+00:00
19
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
2
0
['Depth-First Search', 'Graph', 'C++']
0
detonate-the-maximum-bombs
✅ || C++ || Beginner Friendly || Easy to Understand || O(N^3) Time Complexity ||
c-beginner-friendly-easy-to-understand-o-nmlk
Complexity\n- ## Time complexity:\n1. The outer loop iterates N times, where N is the number of bombs (for(long long i=0; i<bombs.size(); i++)).\n\n Time com
ananttater
NORMAL
2023-06-03T07:21:20.787925+00:00
2023-06-03T07:21:20.787969+00:00
23
false
# Complexity\n- ## Time complexity:\n1. The outer loop iterates N times, where N is the number of bombs (for(long long i=0; i<bombs.size(); i++)).\n\n Time complexity: O(N)\n2. Inside the outer loop, there is a while loop that iterates until the stack is empty.\n\n3. The while loop can potentially iterate N times...
2
0
['C++']
0
detonate-the-maximum-bombs
Kosaraju's Algorithm + Topological Sort
kosarajus-algorithm-topological-sort-by-g1ms2
Intuition\n Describe your first thoughts on how to solve this problem. \nThis is an attempt to arrive at an O(n^2) solution by using the concept of Strongly Con
sinclaire
NORMAL
2023-06-03T05:03:41.920738+00:00
2023-06-03T05:03:41.920779+00:00
430
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThis is an attempt to arrive at an $$O(n^2)$$ solution by using the concept of Strongly Connected Components. This approach still runs at $$O(n^3)$$ time.\n\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1) Creati...
2
0
['Breadth-First Search', 'Topological Sort', 'Strongly Connected Component', 'Python3']
2
detonate-the-maximum-bombs
Easy to Understand with video solution
easy-to-understand-with-video-solution-b-zikr
Intuition\n Describe your first thoughts on how to solve this problem. \nWe have a radius/range for each bomb and every bomb in that radius will explode that wi
mrgokuji
NORMAL
2023-06-02T17:42:46.880274+00:00
2023-06-02T18:55:54.912751+00:00
136
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe have a radius/range for each bomb and every bomb in that radius will explode that will start a chain reaction. This implies that we need to constuct a graph where adjecent nodes will be the bomb index in the range.\n\n# Approach\n<!-- ...
2
0
['Math', 'Depth-First Search', 'Graph', 'Geometry', 'C++']
0
detonate-the-maximum-bombs
Maybe fastest Rust solution (100% beat by runtime and memory)
maybe-fastest-rust-solution-100-beat-by-nwaap
Intuition\nFirst thought was to sort by influence to neighbor bombs, then link top influencers. But I\'ve quickly infered it\'s a wrong way.\n\nSecond thought w
zlumyo
NORMAL
2023-06-02T16:43:24.700486+00:00
2023-06-02T16:47:23.464388+00:00
64
false
# Intuition\nFirst thought was to sort by influence to neighbor bombs, then link top influencers. But I\'ve quickly infered it\'s a wrong way.\n\nSecond thought was describe bombs and ther "victims" as graph. Then there is need to extract separated clusters of connected nodes. Cluster with biggest number of nodes is th...
2
0
['Graph', 'Geometry', 'Rust']
0
detonate-the-maximum-bombs
🔥🔥Easy To Understand Solution- C++ With Comments🔥🔥
easy-to-understand-solution-c-with-comme-c5de
Intuition\nIn the given 2D vector bombs they are giving a co-ordinate with radius.\nSo intuition is to build an adjacency list in which we can see how \nmany mo
yuvrajkarna27
NORMAL
2023-06-02T15:33:14.009708+00:00
2023-06-02T15:46:53.158407+00:00
531
false
# Intuition\nIn the given 2D vector bombs they are giving a co-ordinate with radius.\nSo intuition is to build an adjacency list in which we can see how \nmany more co-ordinates we can access at a particular index.\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nSo the Approach is to...
2
0
['Depth-First Search', 'Graph', 'Recursion', 'C++']
2
detonate-the-maximum-bombs
Java BFS Solution
java-bfs-solution-by-tbekpro-5cvp
Code\n\nclass Solution {\n public int maximumDetonation(int[][] bombs) {\n Arrays.sort(bombs, (o1, o2) -> o2[2] - o1[2]);\n int res = 0;\n
tbekpro
NORMAL
2023-06-02T15:31:21.203843+00:00
2023-06-02T15:31:21.203888+00:00
382
false
# Code\n```\nclass Solution {\n public int maximumDetonation(int[][] bombs) {\n Arrays.sort(bombs, (o1, o2) -> o2[2] - o1[2]);\n int res = 0;\n for (int i = 0; i < bombs.length; i++) {\n int[][] copy = Arrays.copyOf(bombs, bombs.length);\n int count = 1;\n Queue<...
2
0
['Java']
1
detonate-the-maximum-bombs
C++ || DFS || Intuitive || Clean Code
c-dfs-intuitive-clean-code-by-adi1707-834v
Intuition\nThe bombs will detonate all of the bombs which are in its range. So form groups which connects all bombs which are linked to each other.\nCount the n
adi1707
NORMAL
2023-06-02T15:01:04.881847+00:00
2023-06-02T15:01:04.881886+00:00
48
false
# Intuition\nThe bombs will detonate all of the bombs which are in its range. So form groups which connects all bombs which are linked to each other.\nCount the number of bombs connected together in a group. The group with maximum number of bombs will be our answer.\n\n# Approach\nForm the a directed graph which connec...
2
0
['Depth-First Search', 'Graph', 'Geometry', 'C++']
0
detonate-the-maximum-bombs
✨🔥 Python: DFS Solution 🔥✨
python-dfs-solution-by-patilsantosh-yusp
Approach\n Describe your approach to solving the problem. \nDFS Solution\n\n# Complexity\n- Time complexity: O(N^2)\n Add your time complexity here, e.g. O(n) \
patilsantosh
NORMAL
2023-06-02T13:51:36.252139+00:00
2023-06-02T13:51:36.252178+00:00
103
false
# Approach\n<!-- Describe your approach to solving the problem. -->\nDFS Solution\n\n# Complexity\n- Time complexity: O(N^2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(N + E + V)\n where\n - N : Length of array\n - E : Number of Edges\n - V : Number of Nodes\n<!-- Add yo...
2
0
['Python3']
0
detonate-the-maximum-bombs
DFS || Cinch Solution
dfs-cinch-solution-by-bhumit_joshi-ol42
Intuition \n- Determine if a bomb is placed within the destroyable range of other bombs \n- Recall equation of a circle- \n X^2 + Y^2 = R^2\n- Equation for
Bhumit_Joshi
NORMAL
2023-06-02T12:56:40.845594+00:00
2023-06-02T12:56:40.845635+00:00
147
false
# Intuition \n- Determine if a bomb is placed within the destroyable range of other bombs \n- **Recall equation of a circle- \n X^2 + Y^2 = R^2**\n- Equation for bomb Within the Range\n**(X-x)^2 + (Y-y)^2 <= R^2** \n- If there is a bomb within range, establish a connection.\n- Detonate each bomb and identify the on...
2
0
['Depth-First Search', 'C++']
1
detonate-the-maximum-bombs
✅ [Solution][Swift] DFS
solutionswift-dfs-by-adanilyak-0fwx
TC: O(n * n)\nSC: O(n * n)\n\nclass Solution {\n func maximumDetonation(_ bombs: [[Int]]) -> Int {\n func check(\n point: (x: Int, y: Int),
adanilyak
NORMAL
2023-06-02T12:16:44.287850+00:00
2023-06-02T12:16:44.287893+00:00
94
false
**TC:** O(n * n)\n**SC:** O(n * n)\n```\nclass Solution {\n func maximumDetonation(_ bombs: [[Int]]) -> Int {\n func check(\n point: (x: Int, y: Int),\n isInside circle: (x: Int, y: Int, r: Int)\n ) -> Bool {\n let distance = sqrt(\n pow(Double(point.x - ...
2
0
['Depth-First Search', 'Swift']
0
detonate-the-maximum-bombs
Java || 3 ms 100% || Build graph, then DFS from each bomb
java-3-ms-100-build-graph-then-dfs-from-nmg1k
This code converts the bomb location and radius to a graph where each bomb is a node in the graph, and the directional edges of the graph are the other bombs th
dudeandcat
NORMAL
2023-06-02T09:56:26.261787+00:00
2023-06-02T21:53:20.756174+00:00
446
false
This code converts the bomb location and radius to a graph where each bomb is a node in the graph, and the directional edges of the graph are the other bombs that the current bomb can reach with its blast radius. After the graph is build into the variable `links[][]`, a depth-first-search (DFS) is performed starting f...
2
0
['Java']
0
detonate-the-maximum-bombs
C++ || DFS || EASY TO UNDERSTAND
c-dfs-easy-to-understand-by-coder_shaile-6tz0
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
coder_shailesh411
NORMAL
2023-06-02T09:34:34.016290+00:00
2023-06-02T09:34:34.016319+00:00
1,390
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
2
0
['Depth-First Search', 'Graph', 'C++']
1
detonate-the-maximum-bombs
Python Approach by using Euclidean distance and DFS
python-approach-by-using-euclidean-dista-mntf
\n# Code\n\nclass Solution:\n # DFS ...!\n def dfs(self, i):\n self.visit[i] = 1\n \n for node in self.d[i]:\n if self.vis
Bala_1543
NORMAL
2023-06-02T09:14:12.342159+00:00
2023-06-02T09:14:12.342203+00:00
152
false
\n# Code\n```\nclass Solution:\n # DFS ...!\n def dfs(self, i):\n self.visit[i] = 1\n \n for node in self.d[i]:\n if self.visit[node] == 1:\n continue\n self.dfs(node)\n\n def maximumDetonation(self, bombs: List[List[int]]) -> int:\n n = len(bomb...
2
0
['Python3']
0
detonate-the-maximum-bombs
Python short and clean. DFS. Functional programming.
python-short-and-clean-dfs-functional-pr-zeez
Approach\nTL;DR, Similar to Editorial Solution but shorter and cleaner.\n\n# Complexity\n- Time complexity: O(n ^ 3)\n\n- Space complexity: O(n ^ 2)\n\n# Code\n
darshan-as
NORMAL
2023-06-02T04:35:12.450237+00:00
2023-06-02T04:35:12.450283+00:00
605
false
# Approach\nTL;DR, Similar to [Editorial Solution](https://leetcode.com/problems/detonate-the-maximum-bombs/editorial/) but shorter and cleaner.\n\n# Complexity\n- Time complexity: $$O(n ^ 3)$$\n\n- Space complexity: $$O(n ^ 2)$$\n\n# Code\n```python\nclass Solution:\n def maximumDetonation(self, bombs: list[list[in...
2
0
['Depth-First Search', 'Graph', 'Geometry', 'Python', 'Python3']
1
detonate-the-maximum-bombs
JAVA || DFS || C++
java-dfs-c-by-deepakpatel4115-t220
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
deepakpatel4115
NORMAL
2023-06-02T03:33:36.959567+00:00
2023-06-02T03:33:36.959613+00:00
252
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
2
0
['Depth-First Search', 'C++', 'Java']
0
detonate-the-maximum-bombs
Swift | Minimal BFS
swift-minimal-bfs-by-upvotethispls-567u
BFS (accepted answer)\n\nclass Solution {\n func maximumDetonation(_ bombs: [[Int]]) -> Int {\n\t\n func contains(_ a:[Int], _ b:[Int]) -> Bool {\n
UpvoteThisPls
NORMAL
2023-06-02T02:43:35.659159+00:00
2023-06-02T05:29:24.637862+00:00
728
false
**BFS (accepted answer)**\n```\nclass Solution {\n func maximumDetonation(_ bombs: [[Int]]) -> Int {\n\t\n func contains(_ a:[Int], _ b:[Int]) -> Bool {\n let (deltaX, deltaY) = (a[0]-b[0], a[1]-b[1])\n return deltaX * deltaX + deltaY * deltaY <= a[2] * a[2]\n }\n \n ...
2
0
['Swift']
0
detonate-the-maximum-bombs
C++ || using graph
c-using-graph-by-_biranjay_kumar-xm05
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
_Biranjay_kumar_
NORMAL
2023-06-02T01:41:00.680701+00:00
2023-06-02T01:41:00.680750+00:00
2,207
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
2
0
['C++']
0
detonate-the-maximum-bombs
Ruby solution with BFS (100%/100%)
ruby-solution-with-bfs-100100-by-dtkalla-knw8
Intuition\nFor each bomb, find the bombs it immediately causes to explode, then BFS to find how many it explodes in total.\n\n# Approach\n1. Create a hash of bo
dtkalla
NORMAL
2023-06-02T00:14:30.835239+00:00
2023-06-02T00:19:13.511789+00:00
77
false
# Intuition\nFor each bomb, find the bombs it immediately causes to explode, then BFS to find how many it explodes in total.\n\n# Approach\n1. Create a hash of bombs that each bomb will directly explode (each key is an index, each value is an array of indices of other bombs).\n2. Iterate through every pair of bombs. F...
2
0
['Ruby']
1
detonate-the-maximum-bombs
🗓️ Daily LeetCoding Challenge June, Day 2
daily-leetcoding-challenge-june-day-2-by-e1d0
This problem is the Daily LeetCoding Challenge for June, Day 2. Feel free to share anything related to this problem here! You can ask questions, discuss what yo
leetcode
OFFICIAL
2023-06-02T00:00:18.667680+00:00
2023-06-02T00:00:18.667731+00:00
4,455
false
This problem is the Daily LeetCoding Challenge for June, Day 2. Feel free to share anything related to this problem here! You can ask questions, discuss what you've learned from this problem, or show off how many days of streak you've made! --- If you'd like to share a detailed solution to the problem, please creat...
2
0
[]
16
detonate-the-maximum-bombs
[C#] BFS Graph Traversal
c-bfs-graph-traversal-by-sh0wmet3hc0de-dz5l
Intuition\nPorted from Java from: https://leetcode.com/problems/detonate-the-maximum-bombs/solutions/1623563/simple-java-bfs/?page=3\n# Approach\nDue to its rad
sh0wMet3hC0de
NORMAL
2022-12-28T07:53:02.381653+00:00
2022-12-28T07:53:02.381700+00:00
554
false
# Intuition\nPorted from Java from: https://leetcode.com/problems/detonate-the-maximum-bombs/solutions/1623563/simple-java-bfs/?page=3\n# Approach\nDue to its radial exploration nature, BFS almost litteraly fits this problem. I confess I did try first Union-Find, but could only get 125 of LeetCode\'s test cases to pass...
2
0
['Breadth-First Search', 'C#']
0
detonate-the-maximum-bombs
C
c-by-tinachien-zy17
\nint maximumDetonation(int** bombs, int bombsSize, int* bombsColSize){\n bool* check = calloc(bombsSize, sizeof(bool));\n bool** attach = malloc(bombsSiz
TinaChien
NORMAL
2022-11-05T08:01:23.569812+00:00
2022-11-05T08:01:23.569844+00:00
71
false
```\nint maximumDetonation(int** bombs, int bombsSize, int* bombsColSize){\n bool* check = calloc(bombsSize, sizeof(bool));\n bool** attach = malloc(bombsSize * sizeof(bool*));\n for(int i = 0; i < bombsSize; i++){\n attach[i] = calloc(bombsSize , sizeof(bool));\n }\n\n for(int i = 0; i < bombsSiz...
2
0
['Breadth-First Search']
0
detonate-the-maximum-bombs
C++ || Using DFS || Neat code with comments
c-using-dfs-neat-code-with-comments-by-a-bc94
\nclass Solution {\npublic:\n void dfs(int node, vector<bool>&visited, vector<int>adj[], int &currDiffused){\n \n currDiffused += 1;// increasi
AvnUtk_26
NORMAL
2022-10-11T21:32:46.799614+00:00
2022-10-11T21:32:46.799638+00:00
656
false
```\nclass Solution {\npublic:\n void dfs(int node, vector<bool>&visited, vector<int>adj[], int &currDiffused){\n \n currDiffused += 1;// increasing the number of bombs getting detonated as we do dfs traversal\n \n for(auto child : adj[node]){\n if(!visited[child]){\n ...
2
0
['Depth-First Search', 'Graph', 'Geometry', 'C++']
0
detonate-the-maximum-bombs
Easy to understand Java solution using BFS
easy-to-understand-java-solution-using-b-3f4s
See the solution here:\nhttps://github.com/Freeze777/SDE-Interviewer-Notes/blob/main/LeetCodeJava/src/main/java/leetcode/medium/graph/DetonateMaxBombs.java
freeze_francis
NORMAL
2022-10-08T17:30:39.116167+00:00
2022-10-08T17:30:39.116211+00:00
663
false
See the solution here:\nhttps://github.com/Freeze777/SDE-Interviewer-Notes/blob/main/LeetCodeJava/src/main/java/leetcode/medium/graph/DetonateMaxBombs.java
2
0
['Breadth-First Search']
0
detonate-the-maximum-bombs
Easy-understanding || Python || Faster than 85%
easy-understanding-python-faster-than-85-sb7f
Don\'t be afraid about the size of my code, I just break this down in classes and methods! What I did was converte the bombs in a graph, when the ditance betwee
duduita
NORMAL
2022-09-22T22:51:12.822282+00:00
2022-09-22T22:51:49.321540+00:00
1,022
false
Don\'t be afraid about the size of my code, I just break this down in classes and methods! What I did was converte the bombs in a graph, when the ditance between one bomb and another is smaller than the radius of the source bomb, we connect those two bombs on the graph. \n\nAfter this, we can do a DFS approach and use ...
2
0
['Depth-First Search', 'Graph', 'Python', 'Python3']
1
detonate-the-maximum-bombs
Java DFS
java-dfs-by-java_programmer_ketan-werr
\nclass Solution {\n public int maximumDetonation(int[][] bombs) {\n int n = bombs.length;\n Circle[] circles = new Circle[n];\n for(int
Java_Programmer_Ketan
NORMAL
2022-09-21T15:13:53.963310+00:00
2022-09-21T15:13:53.963347+00:00
844
false
```\nclass Solution {\n public int maximumDetonation(int[][] bombs) {\n int n = bombs.length;\n Circle[] circles = new Circle[n];\n for(int i=0;i<n;i++) circles[i] = new Circle(bombs[i][0],bombs[i][1],bombs[i][2]);\n List<List<Integer>> graph = new ArrayList<>();\n for(int i=0;i<n;...
2
0
['Depth-First Search', 'Java']
1
detonate-the-maximum-bombs
[Java] Easy and intuitive with explaination || Graph || DFS || Geometry
java-easy-and-intuitive-with-explainatio-rj7x
\nclass Solution {\n /*\n Make directed graph\n u -> v means, v is in the range of u\n check from which node maximum nodes can be reached and return
khushalabrol
NORMAL
2022-07-21T10:16:07.929147+00:00
2022-07-21T10:16:07.929199+00:00
730
false
```\nclass Solution {\n /*\n Make directed graph\n u -> v means, v is in the range of u\n check from which node maximum nodes can be reached and return the number of nodes reached\n */\n public int maximumDetonation(int[][] bombs) {\n Map<Integer, List<Integer>> graph = new HashMap<>();\n \n...
2
0
['Depth-First Search', 'Graph', 'Java']
0
detonate-the-maximum-bombs
Java with comments 11ms beats 100% DFS
java-with-comments-11ms-beats-100-dfs-by-y9bn
graph is a adjacency list.\n\nclass Solution {\n public int maximumDetonation(int[][] bombs) {\n int n = bombs.length;\n List<Integer>[] graph
ar9
NORMAL
2022-04-16T17:59:23.766573+00:00
2022-04-28T12:44:45.984575+00:00
420
false
graph is a adjacency list.\n```\nclass Solution {\n public int maximumDetonation(int[][] bombs) {\n int n = bombs.length;\n List<Integer>[] graph = new List[n];\n for (int i = 0; i < n; i++) graph[i] = new ArrayList<Integer>();\n\t\t// O(n^2 /2) by using j = i+1\n\t\t for (int i = 0; i < n; i+...
2
0
['Depth-First Search', 'Java']
0
detonate-the-maximum-bombs
Python Solution that you want :
python-solution-that-you-want-by-goxy_co-jvj1
\nclass Solution:\n def maximumDetonation(self, bombs: List[List[int]]) -> int:\n if len(bombs)==1:\n return 1\n \n adlist={i
goxy_coder
NORMAL
2022-03-21T13:20:28.075911+00:00
2022-03-21T13:20:28.075956+00:00
846
false
```\nclass Solution:\n def maximumDetonation(self, bombs: List[List[int]]) -> int:\n if len(bombs)==1:\n return 1\n \n adlist={i:[] for i in range(len(bombs))}\n \n for i in range(len(bombs)):\n x1,y1,r1=bombs[i]\n for j in range(i+1,len(bombs)):\n ...
2
0
['Depth-First Search', 'Python', 'Python3']
0
detonate-the-maximum-bombs
c# : Easy Solution
c-easy-solution-by-rahul89798-1vj2
\tpublic class Solution\n\t{\n\t\tpublic int MaximumDetonation(int[][] bombs)\n\t\t{\n\t\t\tint max = 0;\n\t\t\tDictionary> graph = new Dictionary>();\n\n\t\t\t
rahul89798
NORMAL
2022-02-26T13:54:55.500765+00:00
2022-02-26T13:55:11.166363+00:00
102
false
\tpublic class Solution\n\t{\n\t\tpublic int MaximumDetonation(int[][] bombs)\n\t\t{\n\t\t\tint max = 0;\n\t\t\tDictionary<int, List<int>> graph = new Dictionary<int, List<int>>();\n\n\t\t\tfor (int i = 0; i < bombs.GetLength(0); i++)\n\t\t\t{\n\t\t\t\tif (!graph.ContainsKey(i))\n\t\t\t\t\tgraph[i] = new List<int>();\n...
2
0
['Breadth-First Search', 'Graph']
0
detonate-the-maximum-bombs
Java DFS with memorization, faster than 97%
java-dfs-with-memorization-faster-than-9-bkil
Basic idea is simmilar to highest voted posts, just optimized a little with caching.\nHere I used a Set for marking visited for simplicity and it can also be re
shibainulol
NORMAL
2022-02-24T00:21:36.004792+00:00
2022-02-24T00:21:36.004823+00:00
153
false
Basic idea is simmilar to highest voted posts, just optimized a little with caching.\nHere I used a Set for marking visited for simplicity and it can also be reused later, since it contains info about all bombs that will explode if we start at bomb[i].\n\n````\nclass Solution {\n public int maximumDetonation(int[][]...
2
0
[]
2
detonate-the-maximum-bombs
Simple C++ code | Both BFS and DFS Approaches
simple-c-code-both-bfs-and-dfs-approache-2k3y
1. DFS Approach : \n\n\n// DFS Approach : ---------->\nclass Solution {\npublic:\n \n // find if point p2(x2,y2) will be inside the circle of point p1(x1,
HustlerNitin
NORMAL
2022-02-11T11:54:06.668559+00:00
2022-02-11T11:54:06.668592+00:00
155
false
**1. DFS Approach :** \n```\n\n// DFS Approach : ---------->\nclass Solution {\npublic:\n \n // find if point p2(x2,y2) will be inside the circle of point p1(x1,y1) \n bool insideCircle(int x1, int y1, int r, int x2, int y2){\n\t // euclidean distance\n int dist = ceil(sqrt( pow(abs(x2-x1),2) + pow(a...
2
1
['C', 'C++']
0
lexicographically-smallest-palindrome
[Java/C++/Python] Two Pointers
javacpython-two-pointers-by-lee215-oay0
Explanation\nCompare each s[i] with its symmetrical postion in palindrome,\nwhich is s[n - 1 - i].\n\nTo make the lexicographically smallest palindrome,\nwe mak
lee215
NORMAL
2023-05-21T04:01:48.905500+00:00
2023-05-21T04:01:48.905548+00:00
3,936
false
# **Explanation**\nCompare each `s[i]` with its symmetrical postion in palindrome,\nwhich is `s[n - 1 - i]`.\n\nTo make the lexicographically smallest palindrome,\nwe make `s[i] = s[n - 1 - i] = min(s[i], s[n - i - 1])`\n<br>\n\n# **Complexity**\nTime `O(n)`\nSpace `O(n)`\n<br>\n\n**Java**\n```java\n public String m...
50
0
['C', 'Python', 'Java']
4
lexicographically-smallest-palindrome
Python Elegant & Short | O(n) | 4 Lines
python-elegant-short-on-4-lines-by-kyryl-vf5h
Complexity\n- Time complexity: O(n)\n- Space complexity: O(n)\n\n# Code\n\nclass Solution:\n def makeSmallestPalindrome(self, s: str) -> str:\n letter
Kyrylo-Ktl
NORMAL
2023-05-21T16:26:32.453582+00:00
2023-05-21T16:26:32.453618+00:00
1,490
false
# Complexity\n- Time complexity: $$O(n)$$\n- Space complexity: $$O(n)$$\n\n# Code\n```\nclass Solution:\n def makeSmallestPalindrome(self, s: str) -> str:\n letters = list(s)\n\n for i in range(len(s) // 2):\n letters[i] = letters[~i] = min(letters[i], letters[~i])\n\n return \'\'.joi...
17
0
['Python', 'Python3']
0
lexicographically-smallest-palindrome
Java | Easy solution | 8 lines
java-easy-solution-8-lines-by-judgementd-ita9
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
judgementdey
NORMAL
2023-05-21T04:01:47.176242+00:00
2023-05-21T04:04:34.868753+00:00
2,061
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here...
16
1
['Java']
2
lexicographically-smallest-palindrome
Take min || Very simple and easy to understand solution
take-min-very-simple-and-easy-to-underst-rv5e
Up vote if this solution helps\n# Approach\nTake two iterator one from front and one from back.\nThen take the min of s(front) & s(back) and set both s(front)
kreakEmp
NORMAL
2023-05-21T04:04:17.946790+00:00
2023-05-21T04:56:10.212035+00:00
2,560
false
<b> Up vote if this solution helps</b>\n# Approach\nTake two iterator one from front and one from back.\nThen take the min of s(front) & s(back) and set both s(front) and s(back) to the min value.\n \n# Code\n```\n string makeSmallestPalindrome(string s) {\n int front = 0, back = s.size()-1;\n while(fr...
14
1
['C++']
4
lexicographically-smallest-palindrome
Python 3 || 4 lines, w/ explanation an example || T/S: 58% / 72%
python-3-4-lines-w-explanation-an-exampl-847r
\nclass Solution:\n def makeSmallestPalindrome(self, s: str) -> str: # Example: s = \'sdnvnfe\'\n\n ans, n = list(s), len(s)
Spaulding_
NORMAL
2023-05-21T17:25:08.397632+00:00
2024-06-20T19:18:41.140726+00:00
1,089
false
```\nclass Solution:\n def makeSmallestPalindrome(self, s: str) -> str: # Example: s = \'sdnvnfe\'\n\n ans, n = list(s), len(s) # n = 7 , n//2 = 3\n # ans = [s, d, n, v, n, f, e]\n for i in range(n//2): \n ...
13
0
['Python3']
1
lexicographically-smallest-palindrome
✔💯 DAY 416 | TWO pointers | 0ms 100% | | [PYTHON/JAVA/C++] | EXPLAINED 🆙🆙🆙
day-416-two-pointers-0ms-100-pythonjavac-ez94
Intuition & Approach\n Describe your approach to solving the problem. \n##### \u2022\tThe string is converted to a char array so that the characters can be acce
ManojKumarPatnaik
NORMAL
2023-05-21T04:01:59.985541+00:00
2023-05-21T04:14:22.978269+00:00
1,522
false
# Intuition & Approach\n<!-- Describe your approach to solving the problem. -->\n##### \u2022\tThe string is converted to a char array so that the characters can be accessed more easily.\n##### \u2022\tTwo pointers are initialized to the beginning and end of the array.\n##### \u2022\tA variable is initialized to keep t...
13
0
['Two Pointers', 'Python', 'C++', 'Java', 'Python3']
2
lexicographically-smallest-palindrome
C++ || TWO POINTER || EASY TO UNDERSTAND
c-two-pointer-easy-to-understand-by-gane-bion
\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n\n// <!-- UPVOTE IF THIS CODE IS HELP FULL FOR YOU\n// IF ANY SUGGETION YOU CAN
ganeshkumawat8740
NORMAL
2023-05-21T04:28:02.001411+00:00
2023-05-21T05:11:50.421420+00:00
1,395
false
\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```\n// <!-- UPVOTE IF THIS CODE IS HELP FULL FOR YOU\n// IF ANY SUGGETION YOU CAN COMMENT HERE. -->\nclass Solution {\npublic:\n string makeSmallestPalindrome(string s) {\n int i = 0, j = s.length()-1;//make pointer index\n ...
10
0
['Two Pointers', 'C++']
1
lexicographically-smallest-palindrome
|| in java
in-java-by-2manas1-mq9l
Intuition\n Describe your first thoughts on how to solve this problem. \n\nRemoved the use of StringBuilder s1, as it was not necessary for the task. Instead, I
2manas1
NORMAL
2023-08-11T14:33:08.309541+00:00
2023-08-11T14:33:08.309575+00:00
145
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\nRemoved the use of StringBuilder s1, as it was not necessary for the task. Instead, I directly manipulated the char array ch.\nRemoved the unnecessary sorting of s1, as you only need to replace characters with the smaller of the two.\nU...
5
0
['Java']
0
lexicographically-smallest-palindrome
✅[Python] Simple and Clean, beats 88%✅
python-simple-and-clean-beats-88-by-_tan-erp5
Please upvote if you find this helpful. \u270C\n\n\nThis is an NFT\n\n# Intuition\nThe problem asks us to modify a given string s by performing operations on it
_Tanmay
NORMAL
2023-05-29T07:56:04.687662+00:00
2023-05-29T07:56:04.687703+00:00
467
false
### Please upvote if you find this helpful. \u270C\n<img src="https://assets.leetcode.com/users/images/b8e25620-d320-420a-ae09-94c7453bd033_1678818986.7001078.jpeg" alt="Cute Robot - Stable diffusion" width="200"/>\n\n*This is an NFT*\n\n# Intuition\nThe problem asks us to modify a given string `s` by performing operat...
4
0
['Two Pointers', 'String', 'Python', 'Python3']
0
lexicographically-smallest-palindrome
Python3, Two Lines, Use Smaller characters
python3-two-lines-use-smaller-characters-jr0p
Intuition\nWe are checking pairs of characters: s[i] and s[-i-1] and replace them with the lexicograficaly smaller one of them.\n\n# Complexity\n- Time complexi
silvia42
NORMAL
2023-05-21T04:39:19.970508+00:00
2023-05-21T04:41:00.764962+00:00
986
false
# Intuition\nWe are checking pairs of characters: `s[i]` and `s[-i-1]` and replace them with the lexicograficaly smaller one of them.\n\n# Complexity\n- Time complexity:\n`O(N)`\n\n- Space complexity:\n`O(N)`\n\n# Code\n```\nclass Solution:\n def makeSmallestPalindrome(self, s: str) -> str:\n pal=\'\'.join([m...
4
0
['Python3']
0
lexicographically-smallest-palindrome
c++ solution || easy to understand
c-solution-easy-to-understand-by-harshil-i5f5
Code\n\nclass Solution {\npublic:\n string makeSmallestPalindrome(string s) {\n int left = 0;\n int right = s.length() - 1;\n\n while (l
harshil_sutariya
NORMAL
2023-05-21T04:03:45.328823+00:00
2023-05-21T04:03:45.328852+00:00
952
false
# Code\n```\nclass Solution {\npublic:\n string makeSmallestPalindrome(string s) {\n int left = 0;\n int right = s.length() - 1;\n\n while (left < right) {\n if (s[left] != s[right]) {\n string modified1 = s;\n modified1[right] = s[left];\n\n ...
4
0
['C++']
1
lexicographically-smallest-palindrome
Easy cpp solution
easy-cpp-solution-by-inderjeet09-htvs
\n\n# Code\n\n#include <string>\n#include <algorithm>\n\nclass Solution {\npublic:\n string makeSmallestPalindrome(string str) {\n int start = 0;\n
inderjeet09
NORMAL
2023-05-21T04:02:39.429652+00:00
2023-05-21T04:02:39.429686+00:00
50
false
\n\n# Code\n```\n#include <string>\n#include <algorithm>\n\nclass Solution {\npublic:\n string makeSmallestPalindrome(string str) {\n int start = 0;\n int end = str.length() - 1;\n char ch[str.length()];\n copy(str.begin(), str.end(), ch);\n \n while (start <= end) {\n ...
4
0
['C++']
0
lexicographically-smallest-palindrome
SIMPLE TWO-POINTER C++ SOLUTION
simple-two-pointer-c-solution-by-jeffrin-p1iz
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
Jeffrin2005
NORMAL
2024-07-19T12:46:45.976205+00:00
2024-08-12T17:10:32.239754+00:00
175
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:o(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:o(1)\n<!-- Add your space complexity here, e.g. $$O...
3
0
['C++']
0
lexicographically-smallest-palindrome
Lexicographically Smallest Palindrome (JavaScript | Two Pointers)
lexicographically-smallest-palindrome-ja-9w4p
Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n\n/**\n * @param {string} s\n * @return {string}\n */\nvar makeSmallestPalindrome =
TheCodeLord
NORMAL
2024-04-10T01:04:07.594046+00:00
2024-04-10T01:04:07.594074+00:00
61
false
# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(n)$$\n\n# Code\n```\n/**\n * @param {string} s\n * @return {string}\n */\nvar makeSmallestPalindrome = function(s) {\n let left = 0;\n let right = s.length - 1;\n let str = s.split(\'\');\n\n while(left < right) {\n if(str[left] !...
3
0
['Two Pointers', 'JavaScript']
0
lexicographically-smallest-palindrome
Easy to Understand Java Code || Beats 100%
easy-to-understand-java-code-beats-100-b-4y0d
Complexity\n- Time complexity:\nO(n)\n- Space complexity:\nO(1)\n# Code\n\nclass Solution {\n public String makeSmallestPalindrome(String s) {\n char[
Saurabh_Mishra06
NORMAL
2024-04-08T03:26:04.987994+00:00
2024-04-08T03:26:04.988039+00:00
373
false
# Complexity\n- Time complexity:\nO(n)\n- Space complexity:\nO(1)\n# Code\n```\nclass Solution {\n public String makeSmallestPalindrome(String s) {\n char[] c = s.toCharArray();\n int i = 0, j = s.length()-1;\n\n while(i < j){\n if(c[i] <c[j]){\n c[j--] = c[i++];\n ...
3
0
['Java']
1
lexicographically-smallest-palindrome
Simple - Easy to Understand Solution || Beats - 100%
simple-easy-to-understand-solution-beats-73t9
\n\n# Code\n\nclass Solution {\n public String makeSmallestPalindrome(String s) {\n char str[] = s.toCharArray();\n int i=0, j=s.length()-1;\n
tauqueeralam42
NORMAL
2023-07-17T09:16:49.586100+00:00
2023-07-17T09:16:49.586125+00:00
314
false
\n\n# Code\n```\nclass Solution {\n public String makeSmallestPalindrome(String s) {\n char str[] = s.toCharArray();\n int i=0, j=s.length()-1;\n while(i<j){\n str[i] = (char)Math.min(str[i],str[j]);\n str[j]= str[i];\n i++;\n j--;\n }\n ...
3
0
['Two Pointers', 'String', 'C++', 'Java']
1
lexicographically-smallest-palindrome
Transform
transform-by-votrubac-22sd
C++\ncpp\nstring makeSmallestPalindrome(string s) {\n transform(begin(s), end(s), rbegin(s), begin(s), [](char a, char b){\n return min(a, b);\n })
votrubac
NORMAL
2023-05-24T20:20:35.528265+00:00
2023-05-24T20:20:35.528300+00:00
166
false
**C++**\n```cpp\nstring makeSmallestPalindrome(string s) {\n transform(begin(s), end(s), rbegin(s), begin(s), [](char a, char b){\n return min(a, b);\n });\n return s;\n}\n```
3
0
['C']
1
lexicographically-smallest-palindrome
Python3 Solution
python3-solution-by-motaharozzaman1996-m431
\n\nclass Solution:\n def makeSmallestPalindrome(self, s: str) -> str:\n return \'\'.join(map(min,zip(s,s[::-1])))\n
Motaharozzaman1996
NORMAL
2023-05-22T01:30:15.063773+00:00
2023-05-22T01:30:15.063811+00:00
292
false
\n```\nclass Solution:\n def makeSmallestPalindrome(self, s: str) -> str:\n return \'\'.join(map(min,zip(s,s[::-1])))\n```
3
0
['Python', 'Python3']
0
lexicographically-smallest-palindrome
Diagram & Image Explaination🥇 C++ Full Optimized🔥2 PTR | Well Explained
diagram-image-explaination-c-full-optimi-an8m
Diagram\n Describe your first thoughts on how to solve this problem. \n\n\n\n# Approach\n Describe your approach to solving the problem. \nint i=0,j=s.length()-
7mm
NORMAL
2023-05-21T06:38:00.973777+00:00
2023-05-21T06:38:00.973819+00:00
322
false
# Diagram\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n![code2flow_Gk6T30 (1).png](https://assets.leetcode.com/users/images/ae1522d1-3dc8-4459-981b-2f2ae9f9a7b2_1684650906.2661316.png)\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nint i=0,j=s.length()-1;: Initialize ...
3
0
['String', 'String Matching', 'C++']
1
lexicographically-smallest-palindrome
Two Pointers | C++
two-pointers-c-by-tusharbhart-cehe
\nclass Solution {\npublic:\n string makeSmallestPalindrome(string s) {\n int l = 0, r = s.size() - 1;\n while(l < r) {\n if(s[l] !=
TusharBhart
NORMAL
2023-05-21T04:04:53.727734+00:00
2023-05-21T04:04:53.727779+00:00
590
false
```\nclass Solution {\npublic:\n string makeSmallestPalindrome(string s) {\n int l = 0, r = s.size() - 1;\n while(l < r) {\n if(s[l] != s[r]) {\n char c = min(s[l], s[r]);\n s[l] = s[r] = c;\n }\n l++, r--;\n }\n return s;\n ...
3
0
['Two Pointers', 'C++']
0
lexicographically-smallest-palindrome
Easy Java Solution
easy-java-solution-by-codehunter01-gzty
Approach\n Describe your approach to solving the problem. \nJust check forward and Backword elements are equal or Not. If Not then change bigger one to smaller
codeHunter01
NORMAL
2023-05-21T04:04:17.328788+00:00
2023-05-22T12:45:15.824215+00:00
816
false
# Approach\n<!-- Describe your approach to solving the problem. -->\nJust check forward and Backword elements are equal or Not. If Not then change bigger one to smaller one.\n\n# Complexity\n- Time complexity:$$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(1)$$\n<!-- Add your s...
3
0
['String', 'Java']
0
lexicographically-smallest-palindrome
Short || Clean || Simple || Java Solution
short-clean-simple-java-solution-by-hima-g747
\njava []\nclass Solution {\n public String makeSmallestPalindrome(String s) {\n for(int i=0; i<s.length()/2; i++){\n char c = (char)Math.m
HimanshuBhoir
NORMAL
2023-05-21T04:02:04.975301+00:00
2023-05-21T04:29:56.643585+00:00
2,505
false
\n```java []\nclass Solution {\n public String makeSmallestPalindrome(String s) {\n for(int i=0; i<s.length()/2; i++){\n char c = (char)Math.min((int)s.charAt(i),(int)s.charAt(s.length()-1-i));\n s = s.substring(0,i) + c + s.substring(i+1,s.length()-i-1) + c + s.substring(s.length()-i);\...
3
0
['Java']
5
lexicographically-smallest-palindrome
C++ ✅ || EASY ✅ || 3 Lines
c-easy-3-lines-by-dheeraj3220-lqd4
\n<<<<UpVote\n\n\n\nclass Solution {\npublic:\n string makeSmallestPalindrome(string s) {\n int i=0,j=s.size()-1;\n while(i<j){\n
Dheeraj3220
NORMAL
2023-05-21T04:01:00.834506+00:00
2023-05-21T04:08:36.282301+00:00
388
false
\n**<<<<UpVote**\n\n\n```\nclass Solution {\npublic:\n string makeSmallestPalindrome(string s) {\n int i=0,j=s.size()-1;\n while(i<j){\n if(s[i]<s[j]) s[j--]=s[i++];\n else s[i++]=s[j--];\n }\n return s;\n }\n};\n```
3
0
['Two Pointers', 'C']
1
lexicographically-smallest-palindrome
⬆️🆙✅ Easy to understand & Best solution || 💯 Beats 100% of users with Java || O(n)💥👏🔥
up-easy-to-understand-best-solution-beat-8o1m
Please upvote if my solution and efforts helped you.\n***\n\n\n## Approach - 2 Pointers Method\n1 pointer (i) from starting of the string\nanother pointer (j) f
SumitMittal
NORMAL
2024-06-09T16:35:43.095669+00:00
2024-06-09T16:35:43.095692+00:00
58
false
# Please upvote if my solution and efforts helped you.\n***\n![proof.png](https://assets.leetcode.com/users/images/9a3165aa-00b4-470a-affd-9e55e2a472e6_1717950665.4987402.png)\n\n## Approach - 2 Pointers Method\n1 pointer (i) from starting of the string\nanother pointer (j) from the last of the string\nPut minimum elem...
2
0
['Array', 'Two Pointers', 'String', 'Java']
0
lexicographically-smallest-palindrome
Easy JavaScript solution
easy-javascript-solution-by-navyatjacob-8cyy
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
navyatjacob
NORMAL
2024-02-05T12:32:51.961152+00:00
2024-02-05T12:32:51.961170+00:00
65
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
2
0
['JavaScript']
0
lexicographically-smallest-palindrome
97 ms
97-ms-by-satvik_yewale-1qes
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
Satvik_Yewale
NORMAL
2023-12-18T19:11:55.179331+00:00
2023-12-18T19:11:55.179360+00:00
19
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
2
0
['Python']
0
lexicographically-smallest-palindrome
Beginner-friendly || Simple solution with Two Pointer in Python3 / TypeScript
beginner-friendly-simple-solution-with-t-juh0
Intuition\nLet\'s briefly explain what the problem is:\n- there\'s a string s with lowercase English letters\n- our goal is to modify s to be the lexicographica
subscriber6436
NORMAL
2023-10-23T17:56:28.807623+00:00
2024-01-11T04:42:35.429332+00:00
211
false
# Intuition\nLet\'s briefly explain what the problem is:\n- there\'s a string `s` with lowercase English letters\n- our goal is to modify `s` to be **the lexicographically smallest palindrome**\n\n**A palindrome** is a string, when an original word is equal to its **reversed version**.\nThe simplest way to build this p...
2
0
['Two Pointers', 'String', 'TypeScript', 'Python3']
1
lexicographically-smallest-palindrome
[JAVA] easy solution 95% faster
java-easy-solution-95-faster-by-jugantar-9x8b
\n\n# Approach\n Describe your approach to solving the problem. \nJust check whether elements are equal in the first half and second half of the string. If not
Jugantar2020
NORMAL
2023-07-19T17:02:42.866416+00:00
2023-07-19T17:02:42.866436+00:00
158
false
\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nJust check whether elements are equal in the first half and second half of the string. If not then change lexicographically bigger characters one to smaller ones.\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $...
2
0
['Two Pointers', 'String', 'Java']
0
lexicographically-smallest-palindrome
Simple JAVA Solution for beginners. 9ms. Beats 94.80%.
simple-java-solution-for-beginners-9ms-b-3x77
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time
sohaebAhmed
NORMAL
2023-05-27T09:53:01.394076+00:00
2023-05-27T09:53:01.394106+00:00
867
false
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --...
2
0
['Two Pointers', 'String', 'Java']
0