1 Answers
The longest common subsequence problem is the problem of finding the longest subsequence common to all sequences in a set of sequences. It differs from the longest common substring problem: unlike substrings, subsequences are not required to occupy consecutive positions within the original sequences. The longest common subsequence problem is a classic computer science problem, the basis of data comparison programs such as the diff utility, and has applications in computational linguistics and bioinformatics. It is also widely used by revision control systems such as Git for reconciling multiple changes made to a revision-controlled collection of files.
For example, consider the sequences and. They have 5 length-2 common subsequences: , , , , and ; 2 length-3 common subsequences: and ; and no longer common subsequences. So and are their longest common subsequences.