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...

ความคิดเห็น • 17

  • @GregHogg
    @GregHogg  6 หลายเดือนก่อน +1

    Master Data Structures & Algorithms For FREE at AlgoMap.io!

  • @printhaider
    @printhaider 4 หลายเดือนก่อน +3

    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!

  • @SHIHJUIheh
    @SHIHJUIheh 5 หลายเดือนก่อน +1

    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!

    • @GregHogg
      @GregHogg  5 หลายเดือนก่อน

      Glad to hear it ☺️☺️

  • @geetarjohn
    @geetarjohn 5 หลายเดือนก่อน

    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.

  • @anujsharma9595
    @anujsharma9595 9 หลายเดือนก่อน +1

    I like your way of teaching bro Comment from India

    • @GregHogg
      @GregHogg  9 หลายเดือนก่อน +4

      Thank you so much! Reply from Toronto :)

  • @christianjt7018
    @christianjt7018 5 หลายเดือนก่อน

    the explanation was really clear, thanks!

    • @GregHogg
      @GregHogg  5 หลายเดือนก่อน +1

      You're flying through this!!

    • @christianjt7018
      @christianjt7018 5 หลายเดือนก่อน

      @@GregHogg thanks Greg, your videos are very well explained, I have learned a lot

    • @GregHogg
      @GregHogg  5 หลายเดือนก่อน

      @@christianjt7018 that's amazing 🤩🤩

  • @GarouNguyen
    @GarouNguyen 6 หลายเดือนก่อน

    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

  • @keltoro
    @keltoro 7 หลายเดือนก่อน

    Isn't it better to use DFS here instead?

    • @anthonygong100
      @anthonygong100 6 หลายเดือนก่อน

      He is using DFS, there's just two passes instead of one

    • @2NormalHuman
      @2NormalHuman หลายเดือนก่อน

      he's using DFS but using Stack instead of recursion. Iterative approaches are faster than recursive approaches

  • @souvickmaity4867
    @souvickmaity4867 9 หลายเดือนก่อน

    I also reply from India

  • @UrsKarthikHere
    @UrsKarthikHere 7 หลายเดือนก่อน

    Indian