Longest Common Subsequence (2 Strings) - Dynamic Programming & Competing Subproblems

  Рет қаралды 196,403

Back To Back SWE

Back To Back SWE

Күн бұрын

Code & Problem Statement @ backtobackswe....
Free 5-Day Mini-Course: backtobackswe.com
Try Our Full Platform: backtobackswe....
📹 Intuitive Video Explanations
🏃 Run Code As You Learn
💾 Save Progress
❓New Unseen Questions
🔎 Get All Solutions
Question: You are given 2 strings. Return the length of the longest subsequence that the 2 strings share.
Complexities
n = s1.length()
m = s2.length()
Time: O( nm )
We can upper bound time by the number of subproblems that we are going to solve.
Space: O( nm )
We upper bound space by the number of subproblems we will story answers to. Whether we do (n + 1)(m + 1) or (n)(m) doesn't matter asymptotically.
++++++++++++++++++++++++++++++++++++++++++++++++++
HackerRank: / @hackerrankofficial
Tuschar Roy: / tusharroy2525
GeeksForGeeks: / @geeksforgeeksvideos
Jarvis Johnson: / vsympathyv
Success In Tech: / @successintech

Пікірлер: 1 000
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
Table of Contents: The Problem Introduction 0:00 - 0:25 What Is A Subsequence 0:25 - 1:00 Going Through Examples 1:00 - 2:37 Walking Through A Recursion Tree 2:37 - 12:00 Recursion Tree Finished: Our Answer 12:00 - 13:18 Dynamic Programming Table Walkthrough 13:18 - 13:43 What Are The Subproblems? 13:43 - 14:56 Defining Our Base Cases 14:56 - 16:24 Working On The Inner Table 16:24 - 22:49 DP Table Finished: Our Answer 22:49 - 23:27 This Is Not Intuitive At All 23:27 - 24:11 Time & Space Complexity 24:11 - 24:49 Subscribe Por Favor 24:49 - 25:11 The code for this problem is in the description. Fully commented for teaching purposes.
@panzhang9751
@panzhang9751 4 жыл бұрын
Like this time.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
nice
@Repeatunt1l
@Repeatunt1l 4 жыл бұрын
Thank you for great explanation. Seems like the link to the code is missing in the description.
@AshishSingh-dn8wb
@AshishSingh-dn8wb 4 жыл бұрын
I cant find the code :/
@ankitsanghi
@ankitsanghi 4 жыл бұрын
Where in the description is the code? I can't find it
@shubhamasati4488
@shubhamasati4488 5 жыл бұрын
somebody give this guy an oscar ...plz
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
haha
@arunsudharsan7437
@arunsudharsan7437 5 жыл бұрын
please give him....
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
@@arunsudharsan7437 ye
@PiyushKumar-ey7qw
@PiyushKumar-ey7qw 4 жыл бұрын
He surely deserves it. Till this date I was confused with the table thing, I mugged it up, but today I got it how each and every step is working.
@AnshumanKumar007
@AnshumanKumar007 4 жыл бұрын
Wrong award. The Turing award perhaps.
@adriantran6568
@adriantran6568 4 жыл бұрын
The dp table explanation is the most beautiful thing I've ever seen
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
nice
@muradquliyev6448
@muradquliyev6448 3 жыл бұрын
That is right
@christofrank4862
@christofrank4862 Ай бұрын
Cannot agree More!!
@heyitsnikhil7956
@heyitsnikhil7956 5 жыл бұрын
"okay. this is not intuitive at all. I'm going to be outright and honest." -thanks for saying this. sounds relieving. 😂
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
it isn't lol
@heyitsnikhil7956
@heyitsnikhil7956 5 жыл бұрын
@@BackToBackSWE well, you made it really easy to understand. You are a great teacher! 🙌
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
@@heyitsnikhil7956 thanks
@ssparks1979
@ssparks1979 4 жыл бұрын
It was almost like you were speaking directly to me when you said "Stay with me! Stay with me! I know it is confusing." Thank you so much for this thorough explaination!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
lmao - and sure
@TeeheeTummytums503
@TeeheeTummytums503 5 жыл бұрын
This is absolutely unbelievable that I just now found your channel. Thank you so much for all your hard work. Keep up the great work!!!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
Yeah, KZbin probably won't pick up on this channel for another year or so but I'm ok with that. I'll keep going. And yeah, this video took 6 hours to produce. You guys keep me going. The problem isn't that I can't do these problems, it is that to EXPLAIN them WELL takes a lot of prep time. I have to code the solution, write teachers notes, shoot the video, edit the video, and publish. But yeah, thanks
@TeeheeTummytums503
@TeeheeTummytums503 5 жыл бұрын
@@BackToBackSWE have you considered mentioning your channel in the cscareerquestions subreddit? I know it would be incredibly beneficial to a lot of people there
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
@@TeeheeTummytums503 Tried. Talked to the mods. I tried everything. They won't budge so I gave up. It makes me really angry but at the same time, it is fine. I understand their position. I heard someone posted the channel once and it got like 50-60 upvotes and then the post got taken down. I think they just don't like promotions but...I just have to grow this so big that no one can ignore it. So that's what I'm trying to do. PS: I honestly don't think the channel is ready though. I have HUNDREDS of questions and tens of topics left to cover in high quality and that will take a long time.
@TeeheeTummytums503
@TeeheeTummytums503 5 жыл бұрын
@@BackToBackSWE big L for them. Thanks again for all you do.
@shanugarg8428
@shanugarg8428 4 жыл бұрын
Hey guys here's another KZbin channel for Algorithm : kzbin.info/www/bejne/sJ7ZZZ5srbN5fc0
@sandarabian
@sandarabian 4 жыл бұрын
I was so stumped when the problem was introduced, then at 4:22 it was like a bucket of genius water was dumped on my head. Genius!!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
🚒🚒💧
@memoriesadrift
@memoriesadrift 3 жыл бұрын
This is honestly the best video I have seen on dynamic programming on KZbin. Mad respect to you for you for your down-to-earth, simple to understand explanations.
@The8merp
@The8merp 4 жыл бұрын
Thank you so much. I have finally been able to understand Dynamic Programming Tabulation method. Most people when trying to explain it focus only on the table and don't explain how the code relates to the table properly. Now I understand it. You really have a gift for teaching, keep doing what you are doing. I will make sure to support this channel when I finally get a job
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
Nice, thx
@ravishekranjan7282
@ravishekranjan7282 4 жыл бұрын
This is the best explanation of LCS along DP available on internet.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks
@34521ful
@34521ful 5 жыл бұрын
This video was so good I almost cried... (tears of joy). Amazing work!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
haha
@doruwyl
@doruwyl 5 жыл бұрын
What sets you apart from other coding solving videos is the depth you go into and the effort you put in order that your audience would really understand how to solve the problem. Well done!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
ay, thanks
@LoneWolf.
@LoneWolf. 8 ай бұрын
Your teaching style is best. Why am I saying this? When you were going through the explanation the moment I was falling in confusion you were just there to tell "wait, this might be confusing but I will explain". This gave me the confidence and continued. DP was a nightmare to me. I just got what I wanted. No words to thank you enough. I am from Bangladesh, and I want to say my gratitude, man! Amazingly great explanation.
@blackkiritok
@blackkiritok 4 жыл бұрын
Ok. How easily you explained this is beyond words. Many can code stuff but very VERY rare can explain the way you did. This problem haunted me for around 6 months and after this video I solved it without a sweat I can officially say you have GODLY skills. Thank you so much! I am going to spread this video (or your channel in general) to as many of my friends as possible. Please keep up the good work.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
ok thx
@tanvia29
@tanvia29 5 жыл бұрын
I FINALLY understand. Thank you so much.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sure
@rajeshseptember09
@rajeshseptember09 2 жыл бұрын
I was almost about to give up on "Dynamic Programming" until I saw this video. Best video on the internet for DP ! Hats off man !! Commendable job
@BackToBackSWE
@BackToBackSWE 2 жыл бұрын
Amaze! keep hustling buddy. Try our 5 day free mini course - backtobackswe.com/
@ShortGiant1
@ShortGiant1 4 жыл бұрын
Thank you! You're like stackoverflow for leetcode. The place I look for help when I'm either stumped with a problem, or I've solved it but want the concept firmly set into my head.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
great to hear.
@bhaskarroy5435
@bhaskarroy5435 5 жыл бұрын
I have gone through numerous videos but none of them could explain this problem in a level of depth like you did. Thanks a ton!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sweet thank you
@tpkkxbm
@tpkkxbm 3 жыл бұрын
I never comment on KZbin videos, but I have to for this incredible channel. The way you are helping me develop intuition for these algo problems is unbelievable. Thank you!
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
thanks!
@martinf490
@martinf490 5 жыл бұрын
This is the most intuitive explanation I've come across for this problem please don't stop.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
the boat is moving full speed ahead
@phanichoragudi57
@phanichoragudi57 5 жыл бұрын
Excellent explanation!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
thanks, someone asked for this one so I did it (was going to happen this month anyway)
@caaaarrllooooss
@caaaarrllooooss 4 жыл бұрын
You're the GOAT at explaining these algorithms and problems. Thank you very much
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
ye
@InfinityFnatic
@InfinityFnatic 5 жыл бұрын
The sheer energy and dedication of this guy is amazing, also outstanding explanation ability. If I had only had him as a teacher in high school man, I would have aced every single competition.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
thanks....oh...and..................hey.
@prathamj2215
@prathamj2215 4 жыл бұрын
YOU'VE EXPLAINED IT IN THE MOST BEAUTIFUL WAY POSSIBLE! I LITERALLY WATCHED 7 VIDEOS BEFORE THIS ONE AND YOUR'S TRULY EXPLAINED THE PROBLEM IN THE MOST UNDERSTANDABLE WAY!! THANK YOU! KEEP UP THE GOOD STUFF!!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
OK I WILL CAN I TURN CAPS OFF NOW
@prathamj2215
@prathamj2215 4 жыл бұрын
@@BackToBackSWE XD
@aakashbansal6627
@aakashbansal6627 5 жыл бұрын
Man, Can DP be explained any better than this? Hats off!!!! Thanks for all this stuff. Really made DP a cake walk for all us viewers...
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
nice
@sumansanyal2960
@sumansanyal2960 2 жыл бұрын
This is the only place where I found why the dp table contains n + 1 (+1 for empty strings) and how it corresponds to the intuitive recursion. Amazing stuff! Thanks a ton!
@mikasaackerman2694
@mikasaackerman2694 4 жыл бұрын
OMG thank you!!! For the first time I feel like I've actually understood how DP works!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
No problem!
@vikranttyagiRN
@vikranttyagiRN 4 жыл бұрын
You are an absolute legend. My teacher just did it without explaining anything. You nailed it. Thanks so much
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thx
@tibinyte8697
@tibinyte8697 4 жыл бұрын
You could use frequence vectors and do it in o(strlen(a) + strlen(b) + 26) time complexity and o(strlen(a) + o(strlen(b)) space complexity . It is easier more efficient and does not require DP.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
ok
@anshusharma11
@anshusharma11 5 жыл бұрын
I was running away from DP. But after seeing this video. I am finding it quite interesting. I love the way you explain how to arrived at the solution right form the scratch. Breaking it into sub problems. You changed my thought process. Every where heard that we need to break into sub problems but no one explained that concept like you. Thanks to you for all the wonderful tutorials . Much love form India
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
Yeah, it is fascinating. But pretty annoying. And haha, yeah, people keep saying "love from India" to me. I guess... love from America? 🌽🌽🇺🇸
@wadichemkhi
@wadichemkhi 4 жыл бұрын
You sir deserve a medal ! You are making all stuff i was putting a lot of effort into learning very easy to understand. Thank you
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks
@chiranjeevipippalla
@chiranjeevipippalla 3 жыл бұрын
I’m watching and practicing all your Dynamic programming, backtracking and recursion playlist and I can feel that I’m getting there (understanding, not memorizing). Thank you so much brother 👏👏👏🙏🏻🙏🏻🙏🏻
@akashsingha2616
@akashsingha2616 5 жыл бұрын
Thank you for all your hard work to make us understand DP better.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sure
@shubhamjain1328
@shubhamjain1328 4 жыл бұрын
Anytime I'm stuck with some problem, I search it on youtube hoping that you or csdojo have already made a video about it. I know you might not read this but - thanks a lot you are making a difference.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
i read everything.
@Riceballl88
@Riceballl88 4 жыл бұрын
This video is amazing -- can't believe how stumped I was at first until seeing you go through the table. Thanks so much for sharing.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks and sure.
@dineshsood9110
@dineshsood9110 5 жыл бұрын
Finally, I could understand it. Thanks a lot for this awesome explanation. No one can explain it better.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
thanks
@swapnilsengupta2217
@swapnilsengupta2217 4 жыл бұрын
It's amazing how lucidly he explains the problem. Keep going, sir, you rock!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
ok thx
@rahulgarai4822
@rahulgarai4822 4 жыл бұрын
U have definitely given a good explanation of this. I want this types more. Thanks a lot👍
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
sure
@nhochamvui6070
@nhochamvui6070 2 жыл бұрын
holy moly this is what im looking for. many guys on youtube just showing me the trick to fill the table, they never explain how memoization-table working! Only you explain the key of the memoization approach!!!!!!!!!!!
@lawlietnao_music
@lawlietnao_music 4 жыл бұрын
Dude this is the most amazing well-done explanation of DP that I've ever seen. I love u bro (big hug
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
hey
@satyagopalkothuru7745
@satyagopalkothuru7745 3 жыл бұрын
The explanation is very clear and easily understandable. After listening to this video, I tried to code myself without seeing your code and finally I am succeeded in writing the code for this problem. Even my code looks different to your's but it worked. I really felt happy for that.
@saransh9306
@saransh9306 5 жыл бұрын
Thank you sooooo much for all your hard work..This is an incredible content.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sure, enjoy
@ale9507
@ale9507 3 жыл бұрын
Once again, a superb explanation. Showing the relation of the dp table to the recursion solution was an eye-opener. Now I fully understand what's going on, which really seems to be the vital part of understanding these dp problems. Thanks very much.
@harshjoshi6257
@harshjoshi6257 4 жыл бұрын
i was gonna write that youre genius and the channel is underrated but then i saw that you have like a million subscribers(laughter emoji ) :)
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks and we didnt have many subs for a while - this is the first comment I've read saying we have a lot of subs. This is like a pivotal point in external perception for the common watcher. Fascinating how things grow isn't it
@a.b.c.d.e...
@a.b.c.d.e... 4 жыл бұрын
Genious explanatory skills. You have a one in a million gift of teaching.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks
@kanikaaapan9996
@kanikaaapan9996 4 жыл бұрын
WOWW!! You explained soo well. I wish you would my college professor .How can there be 19 dislikes????
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
lol ye
@MahmoudMahfouz0
@MahmoudMahfouz0 3 жыл бұрын
Those are probably collage "professors"
@ayushanand18
@ayushanand18 Жыл бұрын
The best ever video on this problem! While other people scream out that their playlist is the best, this man literally nails everything down!
@BackToBackSWE
@BackToBackSWE Жыл бұрын
Glad it was helpful! 😄 Also check out our FREE DSA Interview Prep Mini-Course - backtobackswe.com/ 🎉
@vedantiyangar151
@vedantiyangar151 5 жыл бұрын
Hey Ben! Thanks for this! Could we extend this to actually find the Longest common Subsequence instead of just the length? Or would that be more of a backtracking thing?
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
Yes, we can read the dp table using the same logic we used to construct it to trace back the original solution.
@AnnoyingBunny
@AnnoyingBunny 3 жыл бұрын
Thank you for taking the time to make this video. I feel like I never fully understood dynamic programing. The way you break it down clicked instantly with me.
@dylanlarrabee2322
@dylanlarrabee2322 5 жыл бұрын
DO YOU S E E ? great video!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
hahahahahahaha, yes I have odd mannerisms. I cannot overcome them.
@Ashmole3
@Ashmole3 2 жыл бұрын
You are single handedly saving my algorithms class grade. You explain things in a way that I understand a lot better.
@CraigMine
@CraigMine 4 жыл бұрын
Do you have to come up with something like that in an interview by yourself?
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
probably not
@avikverma1034
@avikverma1034 4 жыл бұрын
Bro,this is the best thing on youtube ................You made dynamic programming a piece of cake.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks
@ErikaAlejandraGonzalez
@ErikaAlejandraGonzalez 3 жыл бұрын
why can't my algorithms analysis class be like this? would you mind teaching at my university? ahaha
@ErikaAlejandraGonzalez
@ErikaAlejandraGonzalez 3 жыл бұрын
our teacher treats us like idiots, and I'm like hellooo you just don't do your job right!!
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
ye
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
yeah some suck
@samyakjain6855
@samyakjain6855 4 жыл бұрын
You are absolutely nailing explaining hard concepts that are not at all intuitive in such a simple and easy to understand manner! Keep up the good work!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thx
@arnobchowdhury3191
@arnobchowdhury3191 4 жыл бұрын
Hey, what's your plan for this Valentine's day? Benyam: To upload one of the most non-intuitve Dynamic Programming algorithm...
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
lol - was this video then
@manojrajasekar6035
@manojrajasekar6035 4 жыл бұрын
Best ! It's not about memorizing the solution, it's all about "actual under the hood workflow" of how we derive the solution. Please continue doing this great job. Recommending your channel to my peers.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
hey
@manojrajasekar6035
@manojrajasekar6035 4 жыл бұрын
@@BackToBackSWE Hey Ben
@gunwiththewind
@gunwiththewind 5 жыл бұрын
"So what happens is, this is what happens, do you see what happend?
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
haha what
@pallabjyoti
@pallabjyoti 4 жыл бұрын
Liked...as soon as he finished teaching with the "aab" and "azb" strings. One of the most beautiful explanations I've come across. Thank you : )
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
great, thanks, and sure
@sxganapa1974
@sxganapa1974 5 жыл бұрын
Really good job
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
hey
@MoonStruckHorrorsX
@MoonStruckHorrorsX 5 жыл бұрын
Amazing man. Simply amazing, your method of explaining is so simple and precise. Love the fact that you don't just jump into the code and tell "Oh it'll work like this".
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sure, you're welcome
@user-lu4uo1wj5o
@user-lu4uo1wj5o 4 жыл бұрын
WHY CANT MY PROFESSOR EXPLAIN LIKE THIS? Thanks!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
uh
@thorthegreat10
@thorthegreat10 4 жыл бұрын
Thank you man, one more well-known problem that became clear only after your explanation. Appreciate time and efforts!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
great
@AshishShukla-ro8oy
@AshishShukla-ro8oy 5 жыл бұрын
"JUST EXCELLENT!!!!!!"
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
ye
@xoxo_kylie
@xoxo_kylie 2 жыл бұрын
I can never forget what i learnt from this video .. This is the power of your explanation and breaking down a complex problem into something so easy to understand.. Thanks a lot
@BackToBackSWE
@BackToBackSWE 2 жыл бұрын
Thank you, glad you liked it 😀 Do check out backtobackswe.com/platform/content and please recommend us to your family and friends 😀
@Rock28099
@Rock28099 5 жыл бұрын
0 dislike😎
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
:)
@talesaraujo979
@talesaraujo979 5 жыл бұрын
Man you made me cry. You made me understand the intuition of what DP is all about. I'd likely buy you a pizza right now. Thank you! Cheers from Brazil!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
Hahahaha, wassup from San Francisco, how's Brazil
@rajaganji7982
@rajaganji7982 2 жыл бұрын
I think you made it harder than it already is. Why can't you just say your matching every char in one string to other in the matrix.and when at every point you will know how many have already matched and increase the count from their on.
@zjh976183
@zjh976183 4 жыл бұрын
This is the holy grail of programming problem explanations. In a perfect world, only if all the problems can be explained by this guy :)
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
I know, but I hate doing this and I don't like them. I wish I could clone my brain into a different body that actually cares about all of this and continue on with this body actually programming real things.
@zjh976183
@zjh976183 4 жыл бұрын
​@@BackToBackSWE I can totally understand you. This deformed industry is getting out of hand with all these "coding" interviews, and theres nothing we can do about it except trying our ass out.
@sumitrawat3742
@sumitrawat3742 4 жыл бұрын
great explanation man a lot of other KZbinrs don't even bother with the proper explanation they just write down the formula for evaluation of the DP element but help me visualize the DP table. It's very very helpful thanks, man.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
sure
@jameshizon4861
@jameshizon4861 3 жыл бұрын
I like how when you explain, you keep us engaged. Keep up the enthusiasm!
@MicahBales
@MicahBales 3 жыл бұрын
This video is fantastic. The teacher assumes we know nothing and walks us through every step in plain language. Bravo!
@JeannieTrinh
@JeannieTrinh 5 жыл бұрын
Omg this is the best video that's broken down this type of problem I've ever seen! You've explained this so perfectly and having the first portion connect with the DP table in the second part felt like magic to me XD. This video (plus many of your others) will be watched for yearssss.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
thanks haha
@rajmourya35
@rajmourya35 4 жыл бұрын
ohhh my god ...believe me what i actually know is you are an excellent teacher !! literally thank you from bottom of my heart
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks and sure
@treygranderson148
@treygranderson148 5 жыл бұрын
I finally understand the thought process behind dynamic programming thanks to your diagrams and explanations. THANK YOU.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
nice
@javi3266
@javi3266 2 жыл бұрын
Dude you are AMAZING! Been trying to understand DP for a few days and I undertood it for once! Now I'm gonna keep watching your videos to see how to approach the other kind of problems. Keep up the good work!
@BackToBackSWE
@BackToBackSWE 2 жыл бұрын
Thanks! try out our 5 day free mini course backtobackswe.com/
@satyam644
@satyam644 4 жыл бұрын
This one is the best explanation i have found for this problem. Thank you dude, you are just awesome in the video, no video i found which explains the reason why to take diagonal element value to add with '1' when there is a character match.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
Sure, got get em' 🐅
@harold3802
@harold3802 3 жыл бұрын
Thank you so much, I have gotten an intuition of how to do dp problems through your videos. The explanations are simple and easy to follow.
@BackToBackSWE
@BackToBackSWE 3 жыл бұрын
great to hear
@patrickmayer9218
@patrickmayer9218 11 ай бұрын
On a cell by cell basis: If the characters are not the same, find the maximum value between the cell on the left and the cell above, and put that in the current cell. If the characters are the same, do 1 + (cell[i - 1] [j - 1]), which is 1 + the value that is in the cell to the top left of the current cell. This is because we are essentially removing both characters like in the recursive tree (left to remove character from String Y, up to remove character from String X). The final answer will always be the bottom right. Thanks so much for the video!
@qwarlockz8017
@qwarlockz8017 5 жыл бұрын
Really like your vids and your explanations... a LOT of other people leave out crucial parts and you cover them all! THANKS SO much!
@qwarlockz8017
@qwarlockz8017 5 жыл бұрын
I would love to see you shift this at the end into code... ie you did such a great explanation... but now lets write the code... that would make it perfect!
@qwarlockz8017
@qwarlockz8017 5 жыл бұрын
found the code. I'm a dork
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sure
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
The video is already long af
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
nice
@shrsn
@shrsn 4 жыл бұрын
I always had troubles understanding how to approach the question in general. This is great. Helps understand why we are doing whatever we are doing . Best video
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
great!
@parthokr
@parthokr 4 жыл бұрын
This video deserves more views! Hats off! You nailed it!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks
@andrewjleonard
@andrewjleonard 8 ай бұрын
This was an insanely good explanation. Much better and more in depth than my graduate algorithms course. Thank you!
@neozoan
@neozoan 3 жыл бұрын
Excellent! Excellent! Dynamic programming is my weakness, but little by little I'm getting my head around it. This video was super helpful in my quest.
@pulkitjain9599
@pulkitjain9599 5 жыл бұрын
Only the second time I am going through this topic. Read it before once and couldn't even understand a thing but now I can say I get almost 70-80% of the solution. Thanks a lot!!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
Nice!
@Anoiny
@Anoiny 4 жыл бұрын
Finally discovered what my type of guy is... the kind that can explain dynamic programming well. Dude, I love you.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
no luv u
@akashthakur05
@akashthakur05 3 жыл бұрын
Hi @Back To Back SWE I went through all the videos and was not even a single was as explanatory as you were. Thankyou man you made my day.
@ShubhamSingh-cc1bb
@ShubhamSingh-cc1bb 4 жыл бұрын
Any problem explained in your channel very thoroughly , no video is available with this much of dedication. We want you to explain Rain water trap problem. It needs great explanation.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
thanks and maybe
@yanksrock1000
@yanksrock1000 5 жыл бұрын
Wow, this is probably one of the best algorithm videos I've seen on KZbin. Thanks!
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
sure
@akialter
@akialter 8 ай бұрын
Insane explanation. My professor can explain for 2 hours and could not be as clear your explanation. Every time someone as about LCS I refer them to this video now
@RiteshSingh-lo9cn
@RiteshSingh-lo9cn 5 жыл бұрын
you left me speechless man.. I've learnt this algorithm before too,but it was kind of learning the formula and making the table,even not knowing why was i making those table. Thank u brother
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
nice
@yangyu4489
@yangyu4489 4 жыл бұрын
DUDE so thorough, entertaining, energetic. YUS. Need more of these videos man thank you so much for the work you do. I get DP now thanks to you!
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
nice. yus.
@jagannathhari
@jagannathhari 5 ай бұрын
I finally found explanation I am looking for. You actually explain why we take max(dp[i-1[]j], dp[i][j-1]) and 1+dp[i-1][j-1]. Every one was telling that just follow the instruction you will find the ans.
@SteversIO
@SteversIO 2 жыл бұрын
The way you break this down is the most comprehensive and easy to understand of any videos I've watched 🙌🙏. Thank you for your content sir
@nidhigoswami2526
@nidhigoswami2526 4 жыл бұрын
Your videos really help a lot... I was struggling a lot with DP. Big thanks for making things easy to understand.
@BackToBackSWE
@BackToBackSWE 4 жыл бұрын
sure.
@tarundeepsingh4495
@tarundeepsingh4495 5 жыл бұрын
Thanks man I never understood how it worked and had just learned the recurrence relation. Now I actually got to know dp implementation of it. seriously best explanation video i have come around for this problem ever.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
nice! glad it makes sense
@devinshaw8558
@devinshaw8558 4 ай бұрын
First creator with an american accent to explain to this level, this is best guy on youtube for DP explanations
@sureshgarine
@sureshgarine 2 жыл бұрын
OMG, you are the best at explaining this DP problem. This is by far the best explanation for LCS using DP
@anmolgarg552
@anmolgarg552 3 жыл бұрын
This is what I have been doing. I read the problem I try to solve it. If I am successful, I look for the solution explained by you. If I fail, I look for the solution explained by you and implement it without looking at the code. Currently, the amount of failures is way bigger. But hey, thanks for the really nice explanation.
@cesareborgia9259
@cesareborgia9259 5 жыл бұрын
This guy is a natural. Very good, empathetic (if that makes sense) explanations.
@BackToBackSWE
@BackToBackSWE 5 жыл бұрын
thanks
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15
大家都拉出了什么#小丑 #shorts
00:35
好人小丑
Рет қаралды 99 МЛН
The 0/1 Knapsack Problem (Demystifying Dynamic Programming)
20:30
Back To Back SWE
Рет қаралды 205 М.
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
Find The Longest Increasing Subsequence - Dynamic Programming Fundamentals
19:21
Is Computer Science still worth it?
20:08
NeetCodeIO
Рет қаралды 235 М.
Longest common subsequence algorithm -- example
8:03
Daniel
Рет қаралды 118 М.
I tried using AI. It scared me.
15:49
Tom Scott
Рет қаралды 7 МЛН
Dynamic Programming isn't too hard. You just don't know what it is.
22:31
DecodingIntuition
Рет қаралды 150 М.