InferenceAI

Enter at least two characters to search.

Start free

Repeated DNA Chunks

mediumArrays & Hashing25 min25 XP

A DNA string uses the letters A C G T. Return every 10-letter substring that occurs more than once, sorted alphabetically.

Examples

EXAMPLE WALKTHROUGHtwo repeats

A guided view of the published example, not a trace of your code.

INPUT["AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT"]
TASKrepeated_dna_chunks()
EXPECTED OUTPUT["AAAAACCCCC","CCCCCAAAAA"]

Start with the input values shown in this example.

Example 1 of 3

Input: s = "AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT"

Output: ["AAAAACCCCC","CCCCCAAAAA"]

Explanation: two repeats

Input: s = "AAAAAAAAAAAAA"

Output: ["AAAAAAAAAA"]

Explanation: overlapping

Input: s = "ACGT"

Output: []

Explanation: too short

Hint 1

Slide a length-10 window and count with a dictionary.

Topics

DSAArrays & HashingPython