787. Cheapest Flights Within K Stops | Dijkstras | BFS | Complete Internal Working
Vložit
- čas přidán 24. 07. 2024
- In this video, I'll talk about how to solve Leetcode 787. Cheapest Flights Within K Stops | Dijkstras | BFS
Learn Dijkstras - • 2642. Design Graph Wit...
Learn BFS - • G-05 Breadth First Sea...
Checkout DSA-169 Series: • Aryan DSA-169 Series |...
100Days 100k Placements: • 100 Days 100K Placement
Let's Connect:
📝Linkedin: / aryan-mittal-0077
📸 Instagram: / ez.pz.dsa
📱Telegram : t.me/aryan_mittal_group
🤖 Github: github.com/aryan-0077
About Me:
I am Aryan Mittal - A Software Engineer in Goldman Sachs, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
✨ Timelines✨
0:00 - What to Expect
1:15 - Problem Explanation
2:48 - Dijkstras Intuition
6:52 - Why Normal Dijkstras can be Wrong (Dry Run)
11:22 - Modified Dijkstras (Dry Run)
22:28 - Dijkstras Code Explanation
25:00 - Complexity of Modified Dijkstras
27:08 - BFS Intuition
31:22 - BFS Dry Run
32:39 - BFS Code Explanation
35:03 - BFS Complexity Explanation
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms
Sorry guys, video is a bit late today, it took some time to make notes for this one 🫡📝!!
Kaar diya maaf 😅
It's alright bro, we are always grateful for your work and contribution to the coding community...
😂😂
🫂🫂
Man, There's no way this problem can actually be solved using dijkstra's algo😢...
Such a beautiful explanation as gulab jamun for the dijkstra's algo approach.
Thanks a lot...
My only qtn rn is How did you came up with this solution bro?😂
Glad you loved Rajesh ❤️❤️
Dem how do you always know what I am gonna try and explain the correct way to overcome the problems i encountered after hours of head banging.
Great video !, one approach which I tried was dfs + dp
TLE?
8:49
💀💀🌚😂
Great !! Thanks man!!
❤️❤️🤌🏻🫂
why is the time complexity of bfs solution O(n+e.k)?
if n=99 and k=100 then every node can be visited 2^(flights.size()) time right?
Dijkstra gives tle 😅
8:50 "maksad nahi bhulna guys" 🤣
Aap pehle ki tarah video vale notes ki pdf description me daal diya karo plz
No problem bro 🤜
🫡🫡🫂
If u said "smash the like button" at 35:40 then the like button would've glown, just a fun thing, thanks for the video
Uff esaaa 🫠🫠❤️
not getting
Just to mention your dijkstra's code is wrong..We cannot return distance when node==dst inside the loop....You messed up dijkstra's and bfs together
Bro, I mentioned in video 6 times how it works, still you have a comment like this 🫠, and then people say, why i repeat stuff 🤣
@@ARYANMITTAL Well you can actually repeat it for the 7th time but the code would still be wrong
@@ARYANMITTAL Bro but it will search for other possible solutions as well ,which might be more optimum solution. In the example you just explored one path .
@@gourabchatterjee1778 bro the code is completely right !! You can definitely return the distance because priority queue would have already set the lowest distance and lowest step which we actually want.