longest common subsequence & longest increasing subsequence