Your videos are great! very detailed and clear cut! please keep making such videos :)
@CodingSimplified4 жыл бұрын
Thanks Anirban for your feedback. Keep Watching.
@electronicseverywhere204 Жыл бұрын
Send me recursive code of this q , i understood your explanation :)
@surajgrandhi67424 жыл бұрын
Very good explanation sir, Best DP series , will try to solve remaining
@CodingSimplified4 жыл бұрын
Thanks Suraj for your nice feedback. Keep Watching.
@pratyushvatsa74903 жыл бұрын
3:20 - That is the longest common *subsequence*
@sharuk35453 жыл бұрын
One of the best solution on youtube
@CodingSimplified3 жыл бұрын
Thanks for your nice feedback. Keep Watching.
@omprakashsharma97674 жыл бұрын
This is best solution so far i seen gr8 work bro :)
@CodingSimplified4 жыл бұрын
Glad to hear that. Thanks.
@raman-jn6yt4 жыл бұрын
Hi, I need one help. In the previous problems you explained, our answer is generally stored in the last cell of our solution matrix i.e. sol[m][n]. But in this problem, we have to find maxLCS from our solution 2d-matrix Can you explain that how we decide this?
@CodingSimplified4 жыл бұрын
Decision is made depending on the requirement & storage we've. In this question, we can't apply the same as sol[m][n], as max LCS can be at any place, so whenever there's change we're updating maxLCS & returning as answer. Thanks.
@coollatchu4 жыл бұрын
Can you please elaborate why we need to fill 0's in first row and in first column?
@shankysays8 ай бұрын
Base condition
@aj97063 жыл бұрын
Sir could u explain how to convert recursive dp to bottom up dp iterative version. Recursive solutionz are expensive in hackerearth contests due to stack over flow. Converting to iterative is quite difficult requires lot of practice.
@ram-pc4wk2 жыл бұрын
Aditya Verma channel
@ram-pc4wk2 жыл бұрын
Here u can find
@ujjwaljain97804 жыл бұрын
Sir why we are not initialised the first row and column ,u directly started with I=1 and j=1.wht about I=0 and j=0???
@dandesatvikreddy44242 жыл бұрын
that comes in picture ..he just did if(n==0||m==0)just make it as zeros ..... the first row and first column is n=0&m=0..
@vastauine63983 жыл бұрын
you could have used memoization and changed recursion complexity to O(MN)
@dipteshkumar72473 жыл бұрын
can you please provide memorization source code?
@himanshubansal64254 жыл бұрын
top to bottom dp solution is missing.
@raman-jn6yt4 жыл бұрын
Hi, Would you please highlight purpose of adding 'countOfLCS' in method parameter? I am trying below solution. Would you let me know what is the problem here? private static int lcsRec(String s1, String s2, int m, int n) { /** base condition - if any string is empty, there is no common substring so return 0 */ if (m < 0 || n < 0) return 0; int lcs1, lcs2, lcs3; if (s1.charAt(m) == s2.charAt(n)) lcs1 = 1 + lcsRec(s1, s2, m-1, n-1); else lcs1 = lcsRec(s1, s2, m-1, n-1); lcs2 = lcsRec(s1, s2, m-1, n); lcs3 = lcsRec(s1, s2, m, n-1); return Math.max(Math.max(lcs1, lcs2), lcs3); } Thanks
@CodingSimplified4 жыл бұрын
'countOfLCS' is representing length of Longest Common Substring. - Try with some example like str1 = "abc" & str2 = "abc" - Another example str1 = "abc" & str2 = "ebc" Try to run pseudo code on these example for better understanding.
@shobhitgarg68973 жыл бұрын
DO you get the answer for this problem?Please help!