Find if Path Exists in Graph - Leetcode 1971 - 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 watched so many leetcode vids, I understand their algorithm but they never explain the implementation. You explain the code/implementation so well that I really understand the algorithm a lot better too. Best leetcode TH-cam out here. Thanks for your help!!
I have gone through soooo many videos from youtubers who have done elaborate explanations on DFS, BFS for over 2+ hours but none of them ACTUALLY write proper code to explain how everything works. What is the point of understanding BFS, DFS in theory when you can't write code for it when the time comes. This video is ALL YOU NEED to understand DFS and BFS in graphs.
Thank you soooo much for finally giving a video that is clean, to-the-point, doesn't overexplain, doesn't explain "types of graphs" etc. while explaining BFS and DFS. There is so much BS in tech-youtube space and your channel is a breath of fresh air. Kudos to you
Wow, this is amazing! Thanks so much! Thanks, I added the code, and will add timestamps soon.
For BFS, we can use a 'for' loop instead of deque since 'for' loop 'pop' the item in the queue from the left. Just change 'while q:' to 'for node in q:'
For faster search, use Union Find
Best explanation, clear and concise.
Amazing to-the-point explanation. Thanks @GregHogg!
Glad to hear it!
Excellent explanation, thanks Greg!
Glad you liked it :)
best problem to learn all 3 traversal techniques
Hi greg,
Great that you have been consistently uploading DSA problems. But I wonder what made you switch from posting data science content.
I just got tired of it tbh. I did it for years and I needed to pivot
@@GregHogg which one to go for in 2024 purely from job market pov.
Isn't the space complexity O(n^2) ? If the graph is fully connected, the number of items to store is n(n-1)
What would be the most efficient way to solve this question?
Awesome 🤩