Longest Common Subsequence

Medium
dynamic-programming Google Amazon Meta

Find the length of the longest common subsequence of two strings using dynamic programming.

Example

lcs("abcde", "ace")
# => 3  ("ace")
lcs("abc", "def")
# => 0

Test Cases

Python Editor

Output

Click "Run" to see results...