@Rishi Srivastava
LCS algorithm:
If last characters of both sequences match (or text1[row-1] == text2[col-1]) then
LCS(text1[], text2[]) = 1 LCS(text1[], text2[])
If last characters of both sequences do not match (or text1[row-1] != text2[col-1]) then
LCS(text1[], text2[]) = MAX[text1(LCS(text1[], text2[]), LCS(text1[], text2[]))]
Please refer to my previous videos for more details on LCS problem and solution:
05 - Longest Common Subsequence - Definition
06 - Longest Common Subsequence - Recursive approach
07 - Longest Common Subsequence - Dynamic Programming approach
08 - Longe...st Common Subsequence - Final DP solution in Java
Github:
Hide player controls
Hide resume playing