Two customers' click histories are strings. Return the length of their longest common subsequence.
Signature
lcs(a: string, b: string) → intExample 1
a = "abcde"
b = "ace"
output = 3
'ace' → 3
Example 2
a = "abc"
b = "def"
output = 0
0
Constraints
1 ≤ |a|, |b| ≤ 1000
⌘/Ctrl + Enter runs examples
Run checks the examples. Submit runs every hidden test (17, including large inputs that catch slow solutions).