Copy List with Random Pointer - Leetcode 138 - Linked Lists (Python)

  Рет қаралды 4,432

Greg Hogg

Greg Hogg

Күн бұрын

Пікірлер: 13
@GregHogg
@GregHogg 5 ай бұрын
Master Data Structures & Algorithms For FREE at AlgoMap.io!
@christianjt7018
@christianjt7018 5 ай бұрын
I was able to solve this one by myself but I like your solution a lot more, thanks for sharing!
@GregHogg
@GregHogg 5 ай бұрын
That's awesome!
@TheResponsibleDude
@TheResponsibleDude 4 ай бұрын
Was able to do this in O(1) space complexity by pointing original node's next to new node. And we can go back and forth
@RakeshPandrinki-k6l
@RakeshPandrinki-k6l 3 ай бұрын
this is brilliant solution
@GarouNguyen
@GarouNguyen 5 ай бұрын
why return old_to_new[head] hash map not the new_node you just create?
@omkarwalunj6720
@omkarwalunj6720 3 ай бұрын
old_to_new[head] will return the value of HashMap which points to the head of new list, as we are mapping original list to the new (copied) list in first pass and then creating the new link list in second pass, so when we return old_to_new[head] it will give head of the new list
@shreehari2589
@shreehari2589 9 ай бұрын
Please do clone graph next
@GregHogg
@GregHogg 7 ай бұрын
Sorry for the slow reply but hopefully you saw I did do that problem or you figured it out before that haha
@shreehari2589
@shreehari2589 7 ай бұрын
@@GregHogg yes watched it, thank you 😊
@GregHogg
@GregHogg 7 ай бұрын
@@shreehari2589 Amazing
@ThoXuanLe
@ThoXuanLe 4 ай бұрын
Nice
@yingxie9974
@yingxie9974 27 күн бұрын
Very V
Clone Graph - Leetcode 133 - Graphs (Python)
13:38
Greg Hogg
Рет қаралды 4,9 М.
Copy List with Random Pointer - Linked List - Leetcode 138
10:07
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
If I Had to Start Learning AWS from Scratch in 2025, Here's What I'd Do
15:55
Tiny Technical Tutorials
Рет қаралды 951
Merge Two Sorted Lists - Leetcode 21 - Linked Lists (Python)
9:41
8 Data Structures Every Programmer Should Know
17:09
ForrestKnight
Рет қаралды 234 М.
Diameter of Binary Tree - Leetcode 543 - Trees (Python)
11:16
I Solved 100 LeetCode Problems
13:11
Green Code
Рет қаралды 301 М.
Number of Islands - Leetcode 200 - Graphs (Python)
11:01
Greg Hogg
Рет қаралды 13 М.
How I Mastered Data Structures and Algorithms in 8 Weeks
15:46
Aman Manazir
Рет қаралды 154 М.
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН