http://www.perlmonks.org?node_id=651578


in reply to Longest Common Subsequence Question

Your method would fail for

S1 = aabbb S2 = aabbb S3 = aa

The answer is "aa", but your method will try to find the LCS("bbb", "aa") and will fail to find a result.

Update: Oops, I meant

S1 = aa1bbb S2 = aa2bbb S3 = aa