Longest Common Substring | Recursion and Memoization

  Рет қаралды 11,203

Codebix

Codebix

Күн бұрын

liked this video? Click here / @codebix1096
problem :- practice.geeks...
code :- github.com/luc...

Пікірлер: 66
@anktrj
@anktrj 4 жыл бұрын
I saw 10 videos on this . . . every one just filled the dp table but you helped me see the overlapping subproblem. Thanks man.
@kbhanuprakash9530
@kbhanuprakash9530 2 жыл бұрын
True
@RahulVerma-x1k
@RahulVerma-x1k 6 ай бұрын
correct, everywhere they r explaining tabulation
@ujjwalshrivastava-xs5lx
@ujjwalshrivastava-xs5lx Ай бұрын
Yeah
@csalgo7345
@csalgo7345 4 жыл бұрын
You're the Guru of recursion and a very valuable resource to learn from. Please keep up the great work that you're doing!
@codebix1096
@codebix1096 4 жыл бұрын
Thanks, will do!
@Abhishek-Khelge
@Abhishek-Khelge 3 жыл бұрын
@@codebix1096 Seriously idea is so clear and easy to understand.
@AnandKumar-kz3ls
@AnandKumar-kz3ls 2 жыл бұрын
well done bro just sick and tired of youtubers uploading tabular solution and playlist and kids commenting in comment section you're god of dp and this video proves if you know recursion well and never ever heard of dp before you can solved almost any solution
@imajt5
@imajt5 Жыл бұрын
Thanks for the explanation, but the cases are like 1. If matched, then we will take the max of three cases - fn(i-1, j-1, count + 1), fn(i-1, j, 0) and fn(i, j-1, 0) Bcz there can be case like "pbax " and "pbpbax" this string, so even though string is matching we cannot ignore the other cases 2. If not match, then we have only two case - fn(i-1, j, 0) and fn(i, j-1, 0)
@shaulendrakumar6314
@shaulendrakumar6314 Жыл бұрын
bro can you pls give the correct code of this?
@shaulendrakumar6314
@shaulendrakumar6314 Жыл бұрын
pls bro can you send??
@imajt5
@imajt5 Жыл бұрын
@Shaulendra bhai de dunga baad me...ab dekhna padega
@ADNANAHMED-eo5xx
@ADNANAHMED-eo5xx 3 жыл бұрын
First video I saw on your channel, what an indepth tutorial
@MDEMANURRAHAMAN-
@MDEMANURRAHAMAN- 4 ай бұрын
Best Explanations Indeed ❤
@theuntoldtree
@theuntoldtree 2 жыл бұрын
Guys share this channel, let's support his hardwork , he deserves.
@adityajoshi8578
@adityajoshi8578 Жыл бұрын
this is the only video that helped me ...! gr8 explanation and content
@kanishkanand1555
@kanishkanand1555 3 жыл бұрын
this is o(n^3) because this problem lacks suboptimal structure , but finding longest common suffix of the prefixes takes just o(n^2) and is far more easy to code and implement.
@betabias
@betabias 2 жыл бұрын
can you please elaborate what suboptimal structure is, or any reference link for the same?
@jatinkumar4410
@jatinkumar4410 4 жыл бұрын
Thank you sir...your explanation is very clear!
@pawanpandey2
@pawanpandey2 3 жыл бұрын
You are pro bro in explaining recursion!!
@codebix1096
@codebix1096 3 жыл бұрын
Thank you. Follow our linkedin page for regular updates www.linkedin.com/company/codebix/?viewAsMember=true
@judgebot7353
@judgebot7353 Жыл бұрын
very nice keep going. This is absolute gold content
@SouravGhosh-pb5nm
@SouravGhosh-pb5nm 3 жыл бұрын
Thanks for such a crisp and nice explanation.
@codebix1096
@codebix1096 3 жыл бұрын
You are welcome !
@kushalappaca5324
@kushalappaca5324 2 жыл бұрын
Great way of explaining..
@nishthavan3764
@nishthavan3764 3 жыл бұрын
One Ques though How will string PBAN AND PPBAN Work ?? Longest common is 4 but you it is 3 because P will be removed and BAN and PBAN will be left. I think code is right but explanation is a little wrong there will always be 3 call when we are on current node to account for the problem I just mentioned but there will be 2 calls in the case when not matching but when matching there will be 3 calls.
@TarunKumar-cn6in
@TarunKumar-cn6in 2 жыл бұрын
Crystal clean explanation ..
@rituraj6056
@rituraj6056 3 жыл бұрын
tnks a lot sir,u really feeled about recursion tree
@codebix1096
@codebix1096 3 жыл бұрын
Thank you. Follow our linkedin page for regular updates www.linkedin.com/company/codebix/?viewAsMember=true
@pratikjadon1468
@pratikjadon1468 Жыл бұрын
This solution getting wrong answer in GFG longest common Substring ? Also why we are checking the all three condition even when character of both strings are equal ? plz tell im alot confused
@mayankbadika3101
@mayankbadika3101 Жыл бұрын
Excellent explanation . Keep it up :)
@advik8387
@advik8387 2 жыл бұрын
I think while explaining you forgot one thing, for prsq and pprs - even though the first chars are same, it will still go through diff1 and diff2, because there is a possibility that a longer substring could result from that, the code is correct, but the explanation and recursion map misses this. the ans is 3, but according to explanation it's 1.
@vanshsehgal9475
@vanshsehgal9475 2 жыл бұрын
Yeah I noticed that thing!!
@shaulendrakumar6314
@shaulendrakumar6314 Жыл бұрын
bro can you pls share the corrected code??
@mtoheed1085
@mtoheed1085 2 жыл бұрын
what the powerful videos...really bomb man
@anonymous10906
@anonymous10906 10 ай бұрын
loved it
@sanjayjoshi8807
@sanjayjoshi8807 3 жыл бұрын
c++ solution same like yours giving TLE on GFG can you help in this sir !!
@ankitparashar8730
@ankitparashar8730 3 жыл бұрын
Haa🙄
@AvikNayak_
@AvikNayak_ 2 жыл бұрын
only bottom-up approach is getting accepted.
@varsha4260
@varsha4260 4 жыл бұрын
Sir,you should have put a else statement if the characters are equal ,then we don't have to split it into two parts and just return the same till that part.
@HimanshuKumar-hm4wv
@HimanshuKumar-hm4wv 3 жыл бұрын
great explanation sir
@anktrj
@anktrj 4 жыл бұрын
Also there's one request can you explain how this overlapping subproblem can be visualized in iterative DP technique
@theuntoldtree
@theuntoldtree 2 жыл бұрын
sir difference vaale case ko else m ku nhi rkha?
@AnandKumar-kz3ls
@AnandKumar-kz3ls 2 жыл бұрын
aabc , abc this test case will fail
@vikramshukla6436
@vikramshukla6436 2 жыл бұрын
Key banate waqt beech mein koi bhi string daalna necessary hain kya ?
@pragneshamadavadi2267
@pragneshamadavadi2267 Жыл бұрын
worth watching content !! Understood
@nikhilgoyal8340
@nikhilgoyal8340 3 жыл бұрын
Badiya samjhaya bhai
@pratikjadon1468
@pratikjadon1468 Жыл бұрын
if s[i] == s2[j] then we are checking with 1 + (i-1,j-1) but why the other two recursive condition not in else block . I mean to say if two characters are equal then we use if condtion but we are also executing the (i-1,j) and (i,j-1) even if s[i[ == s2[j] regardless of if condition.
@vinayjangra1401
@vinayjangra1401 Жыл бұрын
yess, because unlike longest commong subsequence here we are not sure that if the first char matches then it would be our opmtimal answer or not, lets say abcde and afcde, here both first char matches , if we just put that statement in if else it means we are including this 'a' in our final answer but final answer will be cde, cde, which has no 'a'(first char). hope you got it
@utkarshchauhan5827
@utkarshchauhan5827 2 жыл бұрын
U r Excellent
@Ankit.yt_885
@Ankit.yt_885 Жыл бұрын
Well done!
@Ajji_stories12
@Ajji_stories12 2 жыл бұрын
super
@anktrj
@anktrj 4 жыл бұрын
And What if some asks me to find out the complexity of the memoization. How to do that? Should I just check the pattern by building the decision tree which can be messy
@toomuchpoop450
@toomuchpoop450 3 жыл бұрын
when its a 2d dp its usually n^2
@raunakkumar6144
@raunakkumar6144 Жыл бұрын
its 3 d dp
@priyanshuplays9457
@priyanshuplays9457 Ай бұрын
Bro it is giving tle on gfg :(
@InderjitSingh-sh9ve
@InderjitSingh-sh9ve 2 жыл бұрын
Cpp solution bhi diya kro please
@samsingh43
@samsingh43 5 ай бұрын
Wrong s1 = pobox s2 = boxax
@suyashsingh4338
@suyashsingh4338 2 жыл бұрын
Still Gives TLE on GFG
@anirudh6549
@anirudh6549 3 жыл бұрын
TLE
@varsha4260
@varsha4260 4 жыл бұрын
Sir your memoized solution is getting time limit exceeded on leetcode
@soumyadiptabanerjee8256
@soumyadiptabanerjee8256 3 жыл бұрын
memoization here is a n^3 approach. Go for dp.
@DMDRPBHU
@DMDRPBHU 3 жыл бұрын
W aaaaaah
@codebix1096
@codebix1096 3 жыл бұрын
Thank you. Follow our linkedin page for regular updates www.linkedin.com/company/codebix/?viewAsMember=true
Longest Common Subsequence | Recursion | Memo | Optimal | Leetcode 1143
39:18
Perfect Squares | leetcode 279 | Hindi
13:45
Codebix
Рет қаралды 5 М.
Whoa
01:00
Justin Flom
Рет қаралды 60 МЛН
I Took a LUNCHBAR OFF A Poster 🤯 #shorts
00:17
Wian
Рет қаралды 17 МЛН
An Unknown Ending💪
00:49
ISSEI / いっせい
Рет қаралды 37 МЛН
Algorithms Lecture 19: Dynamic Programming, Longest Common Subsequence and Longest Common Substring
1:02:33
Ghassan Shobaki Computer Science Lectures
Рет қаралды 10 М.
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
5 Simple Steps for Solving Any Recursive Problem
21:03
Reducible
Рет қаралды 1,2 МЛН
house robber | recursion and memoization | Hindi
17:58
Codebix
Рет қаралды 8 М.
Whoa
01:00
Justin Flom
Рет қаралды 60 МЛН