Shared Subsequence Length
A subsequence of a string is what remains after deleting any number of its characters (possibly none) without reordering the rest. Return the length of the longest string that is a subsequence of both first and second. If the two strings share no character, or either one is empty, return 0.
Example 1
first "harbor"
second "arbiter"
returns 4
arbr can be read in order from both harbor and arbiter, and no longer string can.
Example 2
first "abc"
second "xyz"
returns 0
The strings share no character.
Constraints
0 <= len(first) <= 400 <= len(second) <= 40- Both strings hold lowercase letters only
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.