algorithms
Write a function solution(s1, s2) that returns the length of the Longest Common Subsequence (LCS) of strings s1 and s2.
A subsequence does not need to be contiguous.
Example
solution("abcde", "ace") → 3 # "ace"
solution("abc", "abc") → 3
solution("abc", "def") → 0
Hint: Use dynamic programming with a 2D table.
solution.py
💡 Tip: Press Ctrl+Enter to run