Dsa
Hashing
Hard
Repeated DNA Sequences
A DNA sequence is represented by a string consisting of the characters 'A', 'C', 'G', and 'T'. Your task is to find all 10-letter-long sequences (substrings) that occur more than once in a given DNA molecule string. Return them in any order.
Input Format:
- A single line containing the DNA string (1 <= length <= 10000).
Output Format:
- Print each repeating sequence of 10 letters on a new line.
Example:
Input:
AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT
Output:
AAAAAAAAAA
CCCCCCCCAA
Key concepts
hashingstringscounting
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now