Longest shared subsequence
Given two strings a and b, return the length of the longest sequence of characters that appears in both in the same order, though not necessarily side by side. You may delete characters from either string, but never reorder them.
The comparison is case-sensitive. Aim for O(len(a) · len(b)) time.
Besides the tests, one large input (two 12-letter strings) with a ~100 ms limit (scaled to your device's speed): brute force won't pass.
Examples
shared_subsequence("stone", "longest")→3shared_subsequence("abcbdab", "bdcaba")→4shared_subsequence("abc", "def")→0