Click to reopen instructions.

A subsequence of a string is what’s left after you delete zero or more of its characters without rearranging the ones that remain. So "ACE" is a subsequence of "ABCDE" but "AEC" is not. Unlike a substring, a subsequence doesn’t have to be contiguous.

A longest common subsequence (LCS) of two strings is the longest string that is a subsequence of both of them. For example an LCS of "AGGTAB" and "GXTXAYB" is "GTAB". Among other things, this is how tools like diff figure out what changed between two versions of a file and how biologists compare DNA sequences.

Two strings can have more than one LCS: "AC" and "CA" have two, "A" and "C". When there’s more than one, your methods can return any of them. And if the strings have nothing in common, the LCS is the empty string.

You’ll write this twice: first as a straightforward recursion that works fine but only on short strings, and then again using dynamic programming so it’s fast enough for long ones.

Put definitions here.

Revisions:

Errors