Clone Graph - Leetcode 133 - Graphs (Python)
ฝัง
- เผยแพร่เมื่อ 7 ก.พ. 2025
- Master Data Structures & Algorithms for FREE at AlgoMap.io/
Code solutions in Python, Java, C++ and JS for this can be found at my GitHub repo here: github.com/gah...
Complete DSA Pathway Zero to Hero: • Data Structures & Algo...
Please check my playlists for free DSA problem solutions:
• Fundamental DSA Theory
• Array & String Questions
• 2 Pointers Questions
• Sliding Window Questions
• Binary Search Questions
• Stack Questions
• Linked List Questions
• Tree Questions
• Heap Questions
• Recursive Backtracking...
• Graph Questions
• Dynamic Programming (D...
My Data Science & ML TH-cam Playlist: • Greg's Path to Become ...
Learn Python and Data Science FASTER at mlnow.ai :)
Support the content: / @greghogg
Follow me on Instagram: / greghogg5
Connect with me on LinkedIn: / greghogg
Follow me on TikTok: / greghogg5
Coursera Plus: imp.i384100.ne...
My Favorite Courses:
Data Structures & Algorithms:
UCalifornia San Diego DSA: imp.i384100.ne...
Stanford Algorithms: imp.i384100.ne...
Python Data Structures: imp.i384100.ne...
Meta Coding Interview Prep: imp.i384100.ne...
Python:
UMichigan Python for Everybody: imp.i384100.ne...
Python Mastery from MLNOW.ai: mlnow.ai/cours...
Google IT Automation w/ Python: imp.i384100.ne...
Web Dev / Full Stack:
Meta Front-End Developer: imp.i384100.ne...
IBM Full Stack Developer: imp.i384100.ne...
Meta Back-End Developer: imp.i384100.ne...
John Hopkins HTML, CSS & JS: imp.i384100.ne...
IBM DevOps: imp.i384100.ne...
Cloud Development:
AWS Fundamentals: imp.i384100.ne...
GCP Cloud Engineer: imp.i384100.ne...
Microsoft Azure Fundamentals: imp.i384100.ne...
Game Development:
Michigan State Unity Development: imp.i384100.ne...
UColorado C++ for Unreal Engine: www.coursera.o...
SQL & Data Science:
SQL by MLNOW.ai: mlnow.ai/cours...
Python for Data Science by MLNOW.ai: mlnow.ai/cours...
Google Data Analytics: imp.i384100.ne...
IBM Data Science: imp.i384100.ne...
IBM Data Engineer: imp.i384100.ne...
Machine Learning & AI:
ML Mastery at MLNOW.ai: mlnow.ai/cours...
ML w/ Andrew Ng: www.coursera.o...
Deep Learning w/ Andrew Ng: imp.i384100.ne...
Master Data Structures & Algorithms For FREE at AlgoMap.io!
I'm going to be honest, I really love your explanations. You do it best! Everytime I have any problem trying to understand any blind 75 or the 150 list problem I always search "[input problem] Greg Hogg". I hope you keep it up and I look forward to learning more from your future videos!
Thank you for providing such a great explanation. This is the most clearest explanation I 've seen on the entire internet. Not only did you provide the solution, but you also explained the underlying concepts!
Glad to hear it ☺️☺️
Thanks, this was very helpful. I paused after you described the approach and then implemented my own version of the solution based on your strategy.
My differences were:
1. Using recursive DFS to save on a stack.
2. I doubled the use of my old-to-new mapping dict as a visited set. Because the keys to the dict have to be unique anyway. Not sure that significantly improves efficiency or anything but it did work.
I like your way of teaching bro Comment from India
Thank you so much! Reply from Toronto :)
the explanation was really clear, thanks!
You're flying through this!!
@@GregHogg thanks Greg, your videos are very well explained, I have learned a lot
@@christianjt7018 that's amazing 🤩🤩
hash_map[node] = Node(val=node.val) why it has the rigth to access neighbours atteibute? Why just not Node() bro can you explain, I don't understand
Isn't it better to use DFS here instead?
He is using DFS, there's just two passes instead of one
he's using DFS but using Stack instead of recursion. Iterative approaches are faster than recursive approaches
I also reply from India
Indian