# Repeated DNA Sequences: Explained

Repeated DNA Sequences shows up often in coding rounds. Here is how I talk through it when the interviewer is watching.

## Key idea

Slide a 10-letter window, encode A/C/G/T in 2 bits, and record encodings seen twice. A rolling bitmask keeps each step O(1).

## Steps to say out loud

1. Restate the input and the exact ask, and nail down constraints and overflow.
2. Name the pattern (bitmasks, backtracking with pruning, or interval DP) and why a simpler scan fails.
3. Code it, then trace a short example plus one empty or already-solved edge case.

## Complexity

O(n).

## Common mistake

Inserting raw 10-letter substrings into a set without counting, which reports sequences that appear only once.

## Practice tip

Time yourself: two minutes to explain, ten to code, three to test edges. Disclosure: I work on Linkjob AI. I also keep a practice cheat sheet at www.linkjob.ai.