Longest Common Subsequence — Solution & Editorial
Classic table: dp[i][j] extends by 1 on a character match, else takes the max of dropping one character from either string. One row of memory suffices.
Complexity: O(|A|·|B|)
Classic table: dp[i][j] extends by 1 on a character match, else takes the max of dropping one character from either string. One row of memory suffices.
Complexity: O(|A|·|B|)