Least Common Subsequence implementation in C using O(M+N) space and O(M*N*log(N)) time