Longest common subsequence solution
Bug
Your program fails on this test:
ls.solve(&quot;abddc&quot;, &quot;acddb&quot;);

Your program finds &quot;ab&quot; and &quot;ac&quot; as the longest subsequences, but the actual answer should be &quot;add&quot;.
The problem is that your algorithm is greedy, and it will always use any match, even if the match skips over a part that would produce a better answer.  In my test case, the b in the first string matches the b at the end of the second string, thereby  skipping over the dd in the middle.