C# algorithm for finding the longest common subsequence