Data Structures & Algorithms using JavaScript
/Expert
LCS
Definition
Finding the longest subsequence present in both strings. Requires a 2D DP table. If `s1[i] == s2[j]`, `dp[i][j] = 1 + dp[i-1][j-1]`. Otherwise, `max(dp[i-1][j], dp[i][j-1])`.
Explain Like I'm New
Finding the longest hidden message that two completely different scrambled words share in common.
Interactive Coding Challenges
Longest Common Subsequence
Solution Code
Loading...
Console output will appear here...