Longest Common Substring | Recursion and Memoization

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

I saw 10 videos on this . . . every one just filled the dp table but you helped me see the overlapping subproblem. Thanks man.

anktrj
Автор

You're the Guru of recursion and a very valuable resource to learn from. Please keep up the great work that you're doing!

csalgo
Автор

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

AnandKumar-kzls
Автор

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)

imajt
Автор

Guys share this channel, let's support his hardwork, he deserves.

theuntoldtree
Автор

First video I saw on your channel, what an indepth tutorial

ADNANAHMED-eoxx
Автор

Thanks bro, thats an amazing video, learned a new concept of key in dp.

MohdShoaib-igpi
Автор

this is the only video that helped me ...! gr8 explanation and content

adityajoshi
Автор

You are pro bro in explaining recursion!!

pawanpandey
Автор

very nice keep going. This is absolute gold content

judgebot
Автор

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.

kanishkanand
Автор

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

pratikjadon
Автор

what the powerful videos...really bomb man

mtoheed
Автор

Key banate waqt beech mein koi bhi string daalna necessary hain kya ?

vikramshukla
Автор

Thanks for such a crisp and nice explanation.

SouravGhosh-pbnm
Автор

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.

nishthavan
Автор

c++ solution same like yours giving TLE on GFG can you help in this sir !!

sanjayjoshi
Автор

sir difference vaale case ko else m ku nhi rkha?

theuntoldtree
Автор

Thank you sir...your explanation is very clear!

jatinkumar
Автор

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.

pratikjadon