1642. Furthest Building You Can Reach | 5 ways | Why not DP | Min Heap | Binary Search | Greedy

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

Aryan Mittal

Aryan Mittal

Күн бұрын

In this video, I'll talk about how to solve Leetcode 1642. Furthest Building You Can Reach | Why not DP | Min Heap (Priority Queue) | Binary Search | Greedy
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 - Bakwas
0:39 - Problem Explanation
3:33 - Method 1 - DP
7:33 - Similar Problem (Leetcode 871)
8:15 - Intuition
10:05 - Method 2 - Brute Force (Greedy)
15:00 - Method 3 - Better (Method2 Min Heap)
17:33 - Method 4 - Better (Binary Search)
18:40 - Method 5 - Optimal (Min Heap - Greedy)
20:39 - Dry Run
24:30 - Code Explanation
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms

Пікірлер: 34
@harshal8781
@harshal8781 5 ай бұрын
Bro casually jumping from 10^6 height 💀💀
@learningmaths786
@learningmaths786 5 ай бұрын
😂😂
@arijitsingh1096
@arijitsingh1096 5 ай бұрын
What if it is 10^6 micrometer ?
@iamnoob7593
@iamnoob7593 18 күн бұрын
What a superb presentation skills , Brilliant Explanation. U know audience want details. Thank u.
@ARYANMITTAL
@ARYANMITTAL 5 ай бұрын
I feel like 27mins is overkill for this problem, but for those who are looking for only Solution, please start from 18:40 🫠
@user-xc6ez1kj6q
@user-xc6ez1kj6q 5 ай бұрын
Absolutely not an overkill ! Regards🙌
@arastusharma439
@arastusharma439 5 ай бұрын
Awesome Bro!!!! Your way of building the intution and going from scratch to most optimal is lit !!!
@Sahilsharma-sk5vr
@Sahilsharma-sk5vr 5 ай бұрын
its worth for 27 minutes. greate knowledge shared for beginners
@fraserdab
@fraserdab 5 ай бұрын
Learning 5 approaches is like learning 5 problems, not sure if it Makes sense but all explained nicely is really helpful
@sanskardhyani4112
@sanskardhyani4112 5 ай бұрын
Literally the best explanation on whole of youtube sir. NO KZbin channel delivers this much content and detailing.
@mukulkhanna5071
@mukulkhanna5071 2 ай бұрын
bestt solution on entire earth👏👏👏👏👏👏
@shouryashri2520
@shouryashri2520 5 ай бұрын
Really Fell in love with your explanation brother! Keep up the good work.
@sarankumaar6009
@sarankumaar6009 5 ай бұрын
good explanations thanks :)
@Saurbz
@Saurbz 5 ай бұрын
Really great explanation
@shariqislam786
@shariqislam786 5 ай бұрын
I have a confusion here, 07:35 Without proving that this problem has an optimal substructure can we say that what we are doing is dp? i believe for the algorithm to classify as dp one the main condition is that problem should have optimal substructure and the other being overlapping sub problems.
@slayer8792
@slayer8792 5 ай бұрын
great explanation i tried dp first but i got MLE😅
@ujjwalrockriser
@ujjwalrockriser 5 ай бұрын
Same 😂
@sarankumaar6009
@sarankumaar6009 5 ай бұрын
dont worry same same 😀
@rajrajesh1669
@rajrajesh1669 5 ай бұрын
Is it your b'day 🎈😂
@rahulkumhar609
@rahulkumhar609 5 ай бұрын
but ladders are never used we are checking, if the no. of bricks gets negative??
@harshit_nimesh
@harshit_nimesh 4 ай бұрын
I had a doubt about solving the problem other way like I was implementing just the reverse of what you told like storing the max heap and whenever sum exceeded bricks I would simply use the ladders and if the ladders become 0 then I will keep appending into the max heap, however it didn't work. Can you please help me out in that ?
@AbhishekTiwari-xt1kt
@AbhishekTiwari-xt1kt 2 ай бұрын
You must be doing something wrong because this approach should also work, can you share your solution?
@Sahilsharma-sk5vr
@Sahilsharma-sk5vr 5 ай бұрын
hatsoff
@pratyushsingh5042
@pratyushsingh5042 5 ай бұрын
I don't know why balloons are flowing xDDDD😂😂😂
@apooravkumar2632
@apooravkumar2632 5 ай бұрын
iOS 17 xD
@rajrajesh1669
@rajrajesh1669 5 ай бұрын
Flying*
@harshal8781
@harshal8781 5 ай бұрын
❤🌝❤
@user-kc1mo5un4b
@user-kc1mo5un4b 5 ай бұрын
Please arrange the videos in leetcode daily problem playlist correctly
@swapnilingale4164
@swapnilingale4164 5 ай бұрын
bhai nots ki link bhi attach kardioo
@AbhishekGupta-ik9ql
@AbhishekGupta-ik9ql 5 ай бұрын
please make videos in hindi
@techyou6163
@techyou6163 5 ай бұрын
why is it not working for some test case?? class Solution { public: int furthestBuilding(vector& heights, int bricks, int ladders) { int jumped=0; for(int i=0; i < heights.size() - 1; i++) { if(heights[i + 1]
@arastusharma439
@arastusharma439 5 ай бұрын
This solution is not working because you are not using the bricks optimally means like suppose in case heights=[1,5,1,2,3,4,10000] bricks = 4 and ladder = 1 your code is using all the bricks first going from 1st to 2nd building and then it is using ladder so by that logic you are getting answer 3 but that is not correct as you can use the ladder first and then the remaining bricks to reach the 5th index.
@user-ps6yb7mw4o
@user-ps6yb7mw4o 5 ай бұрын
you mention the word "for sure" like 100 times in every video.... the explanation looks good but the amount of English you speaks is literally unnecessary and annoying at the same time. Try to use the words which are completely worthy and necessary. Its like I just come here to find the way to solve the problem and just want to run away from you because it becomes irritating to see you saying numerous words in the same sentence which can be clearly spelled by you.
@sanskardhyani4112
@sanskardhyani4112 5 ай бұрын
We are not born speaking English and its our second learned language so its a tendency to overspeak in English and use some unnecessary fillers . It happens naturally and how pity of a guy you are instead of looking at your mistakes and learning from here, you are unnecessarily calling out sir on such a petty thing .
Heartwarming moment as priest rescues ceremony with kindness #shorts
00:33
Fabiosa Best Lifehacks
Рет қаралды 37 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:25
CRAZY GREAPA
Рет қаралды 39 МЛН
Happy 4th of July 😂
00:12
Alyssa's Ways
Рет қаралды 64 МЛН
Despicable Me Fart Blaster
00:51
_vector_
Рет қаралды 23 МЛН
Binary Search Algorithm - Computerphile
18:34
Computerphile
Рет қаралды 157 М.
Medium Google Coding Interview With Ben Awad
51:27
Clément Mihailescu
Рет қаралды 1,2 МЛН
Heartwarming moment as priest rescues ceremony with kindness #shorts
00:33
Fabiosa Best Lifehacks
Рет қаралды 37 МЛН