Longest Increasing Path in a Matrix (DFS + Memoization)

  Рет қаралды 18,858

AlgosWithMichael

AlgosWithMichael

Күн бұрын

Пікірлер: 102
@madhav3444
@madhav3444 3 жыл бұрын
I never comment on videos but bro you explained it beautifully. Love from India
@jinny5025
@jinny5025 3 жыл бұрын
Your explanation is so clear that dummies like me also could understand. I just subscribed to your channel Thanks! :)
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Awesome, thank you!
@stephanbranczyk8306
@stephanbranczyk8306 3 жыл бұрын
I love all your explanations! In many cases, they're some of the best. Just one quick question. What animation software/framework are you using to create these animations? Thank you.
@jrajesh11
@jrajesh11 5 ай бұрын
Man you are just awesome! Beautiful illustration . Thanks for the great work. Please keep more coming!
@HornOKPlease
@HornOKPlease 2 жыл бұрын
I love your channel so muchhhhhhhhh
@bibiworm
@bibiworm 2 жыл бұрын
Could you please kindly explain why in the worst case, we visit each cell two times? Scratching my head. Thanks.
@sumishajmani705
@sumishajmani705 2 жыл бұрын
Though I don't know Java much, I use Python but isn't defining the same-named private and public functions an issue? I know it's not because the code is working .. lol .. but how?
@joaopedroviana7332
@joaopedroviana7332 2 жыл бұрын
ur explanation is helping a lot, I'm wondering why am I being request to know it to get a internship
@mohdekrama8597
@mohdekrama8597 3 жыл бұрын
amazing explaination!! but wen u used n for rows and m for cols.. 😑 😛
@vikramshivaprakash3389
@vikramshivaprakash3389 3 жыл бұрын
Had the same problem today for Google phone interview 😬
@karthikkumaresan1091
@karthikkumaresan1091 3 жыл бұрын
Thanks my friend.. you are up there among those who make this world a better place.. Keep rocking!
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Haha wow thank you!
@pranjalbansal8459
@pranjalbansal8459 3 жыл бұрын
please anyone tell me why we are using DFS but not BFS.
@sna241
@sna241 2 жыл бұрын
Crystal clear for dummies like me. Please keep making such videos when you have time. It will help a lot of us. I appreciate the effort into those animations - the best part. I will support on Patreon as soon as I pass the interview. I wish I have found this channel sooner.
@AlgosWithMichael
@AlgosWithMichael 2 жыл бұрын
Thank you! I hope you get your interviews passed!
@Alice-Tokio
@Alice-Tokio 3 жыл бұрын
Omg, you made it look like a very basic and easy problem, thank you!!
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Glad you liked it!
@afayes
@afayes 9 ай бұрын
Is there a link to the code?
@ashishjkumar4790
@ashishjkumar4790 3 жыл бұрын
I have no idea why interviewers ask such questions. I see absolutely no application/actual use of such problem statements/solutions. Longest increasing path in a tree/graph makes more sense, but Matrix!
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Haha yea it is pretty ridiculous
@mrmcyx8283
@mrmcyx8283 2 жыл бұрын
Beautiful day again. ; )
@yuansha9999
@yuansha9999 2 жыл бұрын
The best explantions
@shivamshuklasvlog627
@shivamshuklasvlog627 2 жыл бұрын
please make more and more videos .. we need your explanation seriously bro.
@AlgosWithMichael
@AlgosWithMichael 2 жыл бұрын
A lot more videos on the way
@sunwoodad
@sunwoodad 3 жыл бұрын
Thank you Michael as always! Your explanation is most understandable.
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Thank you Ethan!
@yolopassion
@yolopassion 3 жыл бұрын
You are most underrated on KZbin. Your explanations are crisp and to the point
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Thank you!
@perihanersoy6166
@perihanersoy6166 3 жыл бұрын
Thank you for the good explanation, the algorithm is also really clear and simple. I like it
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
You are welcome!
@DSCuber
@DSCuber 2 жыл бұрын
Great solution! How would you modify this to account for diagonal movement?
@mateoaguirre1352
@mateoaguirre1352 2 жыл бұрын
ME ACABA DE SALVAR EL CULO
@codemonkey2614
@codemonkey2614 2 жыл бұрын
Excellent explanation. Thank you so much! One quick question. When calculating the current position, would it be better if we store all longestIncreasingPath of four directions to cache? Looks like the code only stores the longest increasing path of the four directions + 1 to cache.
@kumarc4853
@kumarc4853 3 жыл бұрын
Mike you always have the biggest Mic :p And also the best explanations.
@AtriTripathi
@AtriTripathi 3 жыл бұрын
More such videos, please. We're all waiting.
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
More on the way
@mahadevmane9375
@mahadevmane9375 2 жыл бұрын
I love the way you explain the problems as well as implement. Thank you very much.
@RupinderSingh-gs8hz
@RupinderSingh-gs8hz 3 жыл бұрын
Also upload leetcode daily question solution
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
These videos take about 10-15 hours start to finish to make, there is no way lol
@sanjayizardar2263
@sanjayizardar2263 3 жыл бұрын
I always learn something new from your videos. Keep posting specially the hard ones.
@bibiworm
@bibiworm 2 жыл бұрын
Now I know how to explain DFS + MEMO. Thank you!
@audreychu1140
@audreychu1140 2 жыл бұрын
I've watched several videos solving this question, and I found yours is the most clear (to me, haha) one. Thank you for this great tutorial!
@parthgupta3799
@parthgupta3799 2 жыл бұрын
Your videos are so helpful sir. Thank you so much! I really like the way you explain the problems and then code them very easily.
@AnkitSharma-dx5yy
@AnkitSharma-dx5yy 3 жыл бұрын
This guy is blessed with some extra ordinary skils. Thanks for the explanation
@willturner3440
@willturner3440 3 жыл бұрын
Getting tle even after 32ms runtime
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
rip
@NithinRajuChandy
@NithinRajuChandy 2 жыл бұрын
The way you articulate the solution, simply the best I’ve seen so far. Thank you!
@innerchoir6690
@innerchoir6690 2 жыл бұрын
This is amazing instruction. Thank you.
@KushalBhatia
@KushalBhatia 2 жыл бұрын
Very detailed and easy to follow when you explain. Great work. Thank you
@abuyahyadiab363
@abuyahyadiab363 3 жыл бұрын
I don't watch the video yet but I'm sure that the video will be helpful
@abuyahyadiab363
@abuyahyadiab363 3 жыл бұрын
Plz keep going
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Thank you, I hope you enjoy it!
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Yep, more to come!
@kunalkumar-ue3hm
@kunalkumar-ue3hm 3 жыл бұрын
What an explanation !!! So excited to explore all the videos. Keep rocking 💥
@TheShamstabrez11
@TheShamstabrez11 3 жыл бұрын
it is failing for me for this input [[7,8,9],[9,7,6],[7,2,3]]. output should be 6 but it gives 4
@bliewhale
@bliewhale 3 жыл бұрын
It is giving 6 with the code .
@ajitbombe5168
@ajitbombe5168 3 жыл бұрын
Thanks Michael... I've completed your full playlist on graph. waiting for more such playlist. ;)
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Awesome, thank you for watching!
@imj3nny
@imj3nny 2 жыл бұрын
Thank you so much for making this video. After watching so many videos, your explanation drove it home for me!!
@AlgosWithMichael
@AlgosWithMichael 2 жыл бұрын
Glad it helped!
@codingessential91
@codingessential91 3 жыл бұрын
really loved the explanation man. just a suggestion, you could do away with background animations on slides. it's a bit distracting. the explanation and ur voice over are more than enough
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
That is really good feedback, thank you
@kumarc4853
@kumarc4853 3 жыл бұрын
A big Thank you for helping me in my journey to getting offers from Google and Linkedin. Excellent content and explanations
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Glad to hear!! Congrats
@Live-hh6li
@Live-hh6li 3 жыл бұрын
Thanks bro I coded myself because your explanation was awesome 😎
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
That is awesome!!
@harshbhardwaj3594
@harshbhardwaj3594 3 жыл бұрын
amazing explanation!
@劉力仁-i1d
@劉力仁-i1d 3 жыл бұрын
so clear!
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Awesome!
@neozoan
@neozoan 3 жыл бұрын
Nicely done. Thank you.
@codedoctor3265
@codedoctor3265 3 жыл бұрын
Wow , Loved your explanation :) . More Videos on FAANG !!!!
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
More to come!
@rtql8d
@rtql8d 3 жыл бұрын
Great solution, very understandable! I modified your solution slightly, instead of a matrix for my cache, I used a Map() and concatenated i + ',' + j to use as keys and max + 1 would be the values.
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Nice, that is a great way to do it
@yuanyingli9069
@yuanyingli9069 2 жыл бұрын
please make more videos, you are the best! I love to use animated to explain the solution! it is so clear!
@AlgosWithMichael
@AlgosWithMichael 2 жыл бұрын
More to come!
@theanikaanisha4414
@theanikaanisha4414 3 жыл бұрын
This code has an infinite loop. We need to track the visited cells and only get into the recursive calls if the cell is not visited.
@KartikChugh
@KartikChugh 3 жыл бұрын
Nope because the flow is one way (from low to high)
@arjay_2002
@arjay_2002 3 жыл бұрын
awesome
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Thanks!
@aminesfahani3563
@aminesfahani3563 3 жыл бұрын
many thanks a 2d array as cache for memoization is very efficient
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Yep it is. This way of using memoization can be applied to many problems as well
@parulagrawal635
@parulagrawal635 3 жыл бұрын
Can you explain the time complexity for recursive solution ? I believe it is 3^(mn) , can you confirm it
@solarkenny
@solarkenny 3 жыл бұрын
Michael explained that it was O(m*n) at 18:00. Due to memoization, you visit each node once.
@taloto07
@taloto07 3 жыл бұрын
without memoization, I believe it's 4^(m*n). because in worst case scenario, you have four choices to make.
@275phuongvy
@275phuongvy 3 жыл бұрын
nice video animation and explanation. Thank you
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Thank you!
@jantejones5441
@jantejones5441 3 жыл бұрын
Excellent video! Keeup up the good work!
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Thank you very much!
@prajwalbhusari8299
@prajwalbhusari8299 3 жыл бұрын
wow man need more videos like this
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
More on the way!
@shreejitnair2174
@shreejitnair2174 3 жыл бұрын
Brilliant please do more hard problems
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Definitely!
@shitijarora5712
@shitijarora5712 3 жыл бұрын
Bestest video on this topic!
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Glad it was helpful!
@mariyadilip595
@mariyadilip595 3 жыл бұрын
Excellent bruh !!❤️
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Thank you!
@sitronco
@sitronco 3 жыл бұрын
Fantastic explanation
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
Thank you!
@tathagatnegi5923
@tathagatnegi5923 3 жыл бұрын
Thanks 👍
@AlgosWithMichael
@AlgosWithMichael 3 жыл бұрын
No problem 👍
Longest Increasing Path in a Matrix - Leetcode 329
17:45
NeetCode
Рет қаралды 61 М.
Breadth First Search grid shortest path | Graph Theory
16:51
WilliamFiset
Рет қаралды 333 М.
The day of the sea 😂 #shorts by Leisi Crazy
00:22
Leisi Crazy
Рет қаралды 2,3 МЛН
Decode String | FAANG Coding Question | Stack
17:03
AlgosWithMichael
Рет қаралды 10 М.
Google Coding Question - Making a Large Island (Hard)
25:11
AlgosWithMichael
Рет қаралды 16 М.
Kadane's Algorithm - Maximum Subarray (Dynamic Programming)
8:24
AlgosWithMichael
Рет қаралды 25 М.
The Backtracking Blueprint: The Legendary 3 Keys To Backtracking Algorithms
13:44
Merge K Sorted Lists - Divide and Conquer Approach
12:01
AlgosWithMichael
Рет қаралды 18 М.
Binary Tree Maximum Path Sum (Animated Walkthrough) (LeetCode)
11:43
AlgosWithMichael
Рет қаралды 22 М.
Coding Interview Prep | 3 MUST KNOW Graph Problem Tips
13:27
AlgosWithMichael
Рет қаралды 18 М.
Shortest Path in a Binary Matrix - Leetcode 1091 - Python
12:34
NeetCodeIO
Рет қаралды 23 М.
Surrounded Regions | BFS & DFS | LeetCode
19:42
AlgosWithMichael
Рет қаралды 4,8 М.