wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit.
I solved this problem without even watching this video, using the techniques brother Sumeet taught in earlier problems like Longest palindroming substring, longest common subsequence etc. That proves how extremely good he is at teaching these staffs. Keep it up bro.
When asked how some tabulation solution works very few people know what's happening inside it, you are the one who knows inside-out of it, thanks a lot for sharing!
There are only 2 words that come to my mind!! ekdum jhakaas!!!! I had seen 3 videos till now for this problem and this is the first video I understood.
Best explanation for this question on the internet. DP solutions are always easy but the important part is how you reached that solution and you have explained that really well.
Thankyou beta! I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem. If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )
Thank you! Cheers! For better experience and precisely arranged content visit on nados.pepcoding.com Don't forget to follow us on Instagram instagram.com/pepcoding/
This question can be done in other way also , i.e, we can also evaluate longest common substring by comparing all suffixes of s1 with all suffixes of s2 and find the longest common prefix .
Thankyou beta! I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem. If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
Some space optimisation : class Solution{ int longestCommonSubstr(String S1, String S2, int n, int m){ // code here int[] prev = new int[S2.length()+1]; int max = 0; for(int i=1;i
ok , whosoever understood this question try thinking out can we do like we are going to store in each cell i , j the LCS between s1(0,i) and s2(0,j). If you figured out the way doing so ,good and if not , why not . comment down below. This will make the understanding of this question crystal clear in your mind. #HAPPYCODING.
Thankyou beta If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
Thank you so much 🙂 and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
I was wondering, brute force complexity should be : O(n^2 + m^2 + n.m). O(n^2) for prefix of first string. O(m^2) for prefix of second string. Then Each element of first prefix list gets compared with second prefix list. Hence O(n.m) Total Complexity: O(n^2 + m^2 + n.m). Please correct me if I am wrong.
n^2 susbtring will be made of first list ,m^2 in another , we will compare everyone of them so n^2*m^2 and each string comapision will take k(max len of both) time , so n^2*m^2*k
sir leetcode pr problem krra tha hashmap tag ki to usme ye question bhi tha bs array die the string ki jgh mne to dp lgaa kr submit krdia lekin solution me hashmap se bhi solution tha kch ROLLING HASH krke kya hota hai sr ye?.
you can take out the length of substring first and store the i and j index of that column , s.susbtring(i-lcs,i) [this is java substring method] will be our answer
Thankyou beta, I am glad you liked it. I also hope that you are watching till end. If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )
This type of content is free unbelievable
Love you Sumeet sir what a teacher ❤️❤️❤️❤️❤️❤️
wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit.
Aaj real meaning smj m aaya,baki log to bus dp bharna batate h.
👍👍.
Thank you sir for these free content
No one gave this kind of insight of the problem , the WHY portion explained is excellent.
Thanks Sir for such a great content.
I solved this problem without even watching this video, using the techniques brother Sumeet taught in earlier problems like Longest palindroming substring, longest common subsequence etc.
That proves how extremely good he is at teaching these staffs.
Keep it up bro.
This video deserves a like tbh, I have seen so many videos on this question but this is the only video saying that why it is happening .Thank you
The way he explains agar koi interview me explain kre to interviewer wahi fan ho jaye.
When asked how some tabulation solution works very few people know what's happening inside it, you are the one who knows inside-out of it, thanks a lot for sharing!
There are only 2 words that come to my mind!! ekdum jhakaas!!!! I had seen 3 videos till now for this problem and this is the first video I understood.
This is by far the most amazing explanation to this problem. Hats off!
This is the most underrated channel for programming on youtube
Best explanation for this question on the internet. DP solutions are always easy but the important part is how you reached that solution and you have explained that really well.
Why u did?
J
This channel is a life saver
i really impressed by your explanation.
thanks man for this.
Thankyou beta!
I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )
All time GOAT, Summet Sir! 🙏
THE BEST EXPLANATION !!!!!!
Thank you! Cheers!
For better experience and precisely arranged content visit on nados.pepcoding.com
Don't forget to follow us on Instagram instagram.com/pepcoding/
This question can be done in other way also , i.e, we can also evaluate longest common substring by comparing all suffixes of s1 with all suffixes of s2 and find the longest common prefix .
yes, true.
can you share your code
Excellent explaination
Good Content as usual .
super explained 💥💥💥💥💥💥💥💥
nice explanation sir...... akdm clear ho gya.😊😊😊😊
Bhot he bdiya, aise he lge rho aur bdte rho😊🙏
Woah❤
isse kehte h explaination🙌, this was amazing!
we can use unordered_set and time complexity can reduced to n^3
Dil se thank you bhai for providing the best content and giving so much time and effort to help us.
Thankyou beta!
I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
you are really too good sir.......
Some space optimisation :
class Solution{
int longestCommonSubstr(String S1, String S2, int n, int m){
// code here
int[] prev = new int[S2.length()+1];
int max = 0;
for(int i=1;i
Awesome Explanation......Keep making videos
This is the first question of tabular dp I solved without watching the solution
This explanation really gave a feel of the solution. Even better than AV's video
Glad, it was helpful
For better experience and well organised content sign up on nados.io
ok , whosoever understood this question try thinking out can we do like we are going to store in each cell i , j the LCS between s1(0,i) and s2(0,j). If you figured out the way doing so ,good and if not , why not . comment down below. This will make the understanding of this question crystal clear in your mind. #HAPPYCODING.
One of the best explanation ❤️
Extremely well explanation sir
Great explanation sir
Glad you liked it!
Keep learning
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
Sr bina trick jaane ke sbhi prefix ka common suffix ans hai to kaafi mushkil hai complexity km krna.
agr trick pta ho tbhi hoga km complexity me
Sir,Please make a video on a backtracking solution of longest comon substring.
Sir you are doing a very good job, keep going
Thank you, I will
sir your explaination is so very good thankyou :)
Wonderful explanation sir🙏🙏🙏🙏
Great explanation. Thank you!
Brilliant brilliant brilliant !!!!
Wonderful explanation !!
Great Explanation Sir
Thankyou beta If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
@@Pepcoding Done Sir
MInd blowing explanation...super
Thank you so much 🙂 and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
I was wondering, brute force complexity should be : O(n^2 + m^2 + n.m).
O(n^2) for prefix of first string.
O(m^2) for prefix of second string.
Then Each element of first prefix list gets compared with second prefix list. Hence O(n.m)
Total Complexity: O(n^2 + m^2 + n.m).
Please correct me if I am wrong.
n^2 susbtring will be made of first list ,m^2 in another , we will compare everyone of them so n^2*m^2 and each string comapision will take k(max len of both) time , so n^2*m^2*k
understood
38/79 done
Awesome
👍.
Sir can you plzz guide me regarding scope of placement after doing MTECH from IITB.I mean to say if I do good there will I get good tech companies.
thank you so much sir
Nice explain ❤️❤️
Sir, please make a video on finding common substring of n strings.
Love you
sir leetcode pr problem krra tha hashmap tag ki to usme ye question bhi tha bs array die the string ki jgh
mne to dp lgaa kr submit krdia
lekin solution me hashmap se bhi solution tha kch
ROLLING HASH krke
kya hota hai sr ye?.
Sir please tell how we will get the longest common string not their length?
@@Kashish_Batra thank u so much
Can anyone guide me if I want to print that substring itself as output then how should I proceed
you can take out the length of substring first and store the i and j index of that column , s.susbtring(i-lcs,i) [this is java substring method] will be our answer
sir ji ye vala question memoization se kardo plz.Iska recursive formula banana bohot mushkil pad raha hai
Can't we just solve it like longest common subsequence and simply store 0 whenever characters are unequal
For better insight, visit nados.pepcoding.com, post your doubts, community will help you out there.
I like your explaination ways what?how ?why?it make me think a problem of dp easy ???
Thankyou beta,
I am glad you liked it. I also hope that you are watching till end.
If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )
Sir, Can you upload egg drop problem tomorrow?
aj nahi kal
sir 8 easy questions aane the na dp se pehle ?
bhai aane de jo video daal rhe h saahi h SIR kuch soch ke hi daal rhe honge
@@subhamthakur565 yar sir ne khud hi kaha hai ki pehle 8 easy fir 2 dp isliye pucha
brute complexity will be n(n2 +m2) no n. n2 .m2