Problem 10: Finding Repeats in DNA

Medium

DNA sequences often contain repeats, which are contiguous segments of the same nucleotide sequence. Finding these repeats is crucial in understanding the genome structure. For this problem, identify all repeated substrings of length `n` within a given DNA sequence.

Write a program to find all the repeated substrings of length `n` within the provided DNA sequence. Return the starting positions of each repeat.

Sample Input:

ATCGATCGA 3

Sample Output:

1 5

Constraints:

The DNA sequence will contain at most 1,000 nucleotides.

Explanation:

The sample input contains the DNA sequence "ATCGATCGA" and the repeat length `3`. The repeats "ATC" start at positions 1 and 5.

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our app uses cookies to enhance your experience. Check Now
Ok, Go it!