Added longest subsequence method