Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Repeated DNA Sequences

XPChallenge Points: 20
levelLevel: Medium

A DNA sequence is composed of nucleotides represented by the characters 'A', 'C', 'G', and 'T'.
For example, "ACGTACGTAA" is a valid DNA sequence.

When analyzing DNA, it is often useful to detect repeated patterns of nucleotides.

You are given a string s that represents a DNA molecule.
Return all the 10-letter-long sequences (substrings) that occur more than once in s.

The order of the returned sequences does not matter.

Example 1:

Input: s = "AAAAAACCCCCAAAAAACCCCCGGGGGGTTTTTT"

Output: ["AAAAAACCCC","AAAAACCCCC"]

Example 2:

Input: s = "ACGTACGTACGTGGGTTTACGTACGTAC"

Output: ["ACGTACGTAC"]

Example 3:

Input: s ="TTTTTCCCCCGGGGGTTTTTCCCCCGGGGG"

Output: ["TTTTCCCCCG","TTTTTCCCCC","TTTCCCCCGG","TTCCCCCGGG","CCCCCGGGGG","TCCCCCGGGG"]

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result