Skip to content

Finding a Shared Motif

Rosalind Problem

Given: A collection of \(k\) (k≤100) DNA strings of length at most 1 kbp each in FASTA format.

Return: A longest common substring of the collection. (If multiple solutions exist, you may return any single solution.)

Sample Dataset

>Rosalind_1
GATTACA
>Rosalind_2
TAGACCA
>Rosalind_3
ATACA

Sample Output

AC

Python Playground

dna = '''>Rosalind_1 GATTACA >Rosalind_2 TAGACCA >Rosalind_3 ATACA''' # dna is given as input DNA FASTA # Write your code here Ex().check_or(has_output('CA'),has_output('TA'),has_output('AC')) success_msg("Great job!")