Problem
A string is a supersequence of another string if contains as a subsequence.
A common supersequence of strings and is a string that serves as a supersequence of both and . For example, "GACCTAGGAACTC" serves as a common supersequence of "ACGTC" and "ATAT". A shortest common supersequence of and is a supersequence for which there does not exist a shorter common supersequence. Continuing our example, "ACGTACT" is a shortest common supersequence of "ACGTC" and "ATAT".
Given: Two DNA strings and .
Return: A shortest common supersequence of and . If multiple solutions exist, you may output any one.
一个字符串 是一种超层另一个字符串 如果 包含 作为子序列。
一个常见的超序列串 和 是一个字符串,两者都作为 和 。例如,“ GACCTAGGAACTC”用作“ ACGTC”和“ ATAT”的通用超序列。一个最短共同超序列的 和 是一个超序列,对于该超序列不存在较短的通用超序列。继续我们的示例,“ ACGTACT”是“ ACGTC”和“ ATAT”的最短常见超序列。
给出:两个DNA字符串 和 。
返回:的最短公共超序列 和 。如果存在多个解决方案,则可以输出任何一个。
Sample Dataset
ATCTGAT
TGCATA
Sample Output
ATGCATGAT