Problem
A string is a common subsequence of strings and if the symbols of appear in order as a subsequence of both and . For example, "ACTG" is a common subsequence of "AACCTTGG" and "ACACTGTGA".
Analogously to the definition of longest common substring, is a longest common subsequence of and if there does not exist a longer common subsequence of the two strings. Continuing our above example, "ACCTTG" is a longest common subsequence of "AACCTTGG" and "ACACTGTGA", as is "AACTGG".
Given: Two DNA strings and (each having length at most 1 kbp) in FASTA format.
Return: A longest common subsequence of and . (If more than one solution exists, you may return any one.)
的字符串是一个公共子串和如果所述符号 显示在顺序作为序列两者的和。例如,“ ACTG”是“ A A C C T T G G ”和“ A CA CTG TGA”的共同子序列。
类似的定义最长的公共子, 是一个最长公共子序列的和如果不存在这两个字符串较长公共子。继续我们上面的示例,“ ACCTTG”是“ A ACCTTG G”和“ AC A CT G TG A”的最长共同子序列,“ AACTGG ”也是。
给定:两个DNA串 ,(每个长度最多1 kbp)为FASTA格式。
返回:中最长的公共子和。(如果存在多个解决方案,则可以返回任何一个。)
Sample Dataset
>Rosalind_23 AACCTTGG >Rosalind_64 ACACTGTGA
Sample Output
AACTGG