CLONE GRAPH | LEETCODE # 133 | PYTHON BFS SOLUTION

  Рет қаралды 3,157

Cracking FAANG

Cracking FAANG

Күн бұрын

Пікірлер: 16
@roywastaken
@roywastaken Жыл бұрын
your solutions are lowkey better than Neetcode's and that's crazy
@crackfaang
@crackfaang Жыл бұрын
I’d rather have his subscriber count though 😂
@janarboke4005
@janarboke4005 5 ай бұрын
I like how you went through what the hashmap will look like in the beginning, very clear
@sarayarmohammadi3376
@sarayarmohammadi3376 10 ай бұрын
Please keep posting videos. I really like your solutions better than NeetCode most of the times.
@noextrasugar
@noextrasugar 3 ай бұрын
I don't understand how this channel doesn't have 500k+ subscribers??!
@TAEWANKIM88
@TAEWANKIM88 Жыл бұрын
I like this version of using BFS. Thanks!
@l501l501l
@l501l501l Жыл бұрын
Very intuitive compared to DFS version in most of the videos.
@zungulutrungu6407
@zungulutrungu6407 2 жыл бұрын
hey king could you please do 1129. Shortest Path with Alternating Colors ? thanks and keep uploading!!
@crackfaang
@crackfaang 2 жыл бұрын
Sure, let me add it to my work queue
@H4WKGAMING
@H4WKGAMING 2 жыл бұрын
great explanation!
@crackfaang
@crackfaang 2 жыл бұрын
Thanks for your support and make sure to subscribe so you don’t miss future videos!
@H4WKGAMING
@H4WKGAMING 2 жыл бұрын
@@crackfaang can you please do Product of Array Except Self?
@subee128
@subee128 10 ай бұрын
Thanks
@user-vt8dd6fj7v
@user-vt8dd6fj7v 2 жыл бұрын
Am super confused on line 19
@derilraju2106
@derilraju2106 Жыл бұрын
You are just pushing each neighbor into the neighbors list of the parent node
@derilraju2106
@derilraju2106 Жыл бұрын
If someone is looking for equivalent DFS solution: from collections import deque class Solution: def cloneGraph(self, node: 'Node') -> 'Node': if not node: return None cloned = {} cloned[node] = Node(node.val,[]) # DFS solution def dfs(node): if not node: return None for neigh in node.neighbors: if not neigh in cloned: cloned[neigh] = Node(neigh.val,[]) dfs(neigh) cloned[node].neighbors.append(cloned[neigh]) dfs(node) return cloned[node]
Amazon Coding Interview Question - Clone Graph (LeetCode)
13:56
AlgosWithMichael
Рет қаралды 33 М.
NEXT PERMUTATION | LEETCODE # 31 | PYTHON OPTIMAL SOLUTION
18:50
Cracking FAANG
Рет қаралды 13 М.
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 3,3 МЛН
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 96 МЛН
Don't underestimate anyone
00:47
奇軒Tricking
Рет қаралды 16 МЛН
Clone Graph - Leetcode 133 - Graphs (Python)
13:38
Greg Hogg
Рет қаралды 3,9 М.
MAKING A LARGE ISLAND | LEETCODE # 827 | PYTHON SOLUTION
22:09
Cracking FAANG
Рет қаралды 8 М.
Clone Graph - Depth First Search - Leetcode 133
11:48
NeetCode
Рет қаралды 230 М.
ACCOUNTS MERGE | LEETCODE # 721 | PYTHON SOLUTION
23:04
Cracking FAANG
Рет қаралды 11 М.
Graph Valid Tree - Leetcode 261 - Python
14:11
NeetCode
Рет қаралды 103 М.