solve(s) — s is a DNA string over the letters A C G T. Return every
10-letter-long substring that occurs more than once in s, each listed once, in
ascending alphabetical order.
Collecting all substrings in a map works but stores many long strings. Since there are only
four letters, encode each one in 2 bits (A=0, C=1, G=2, T=3): a 10-letter window is a
20-bit integer. Slide the window by shifting the integer left by 2, OR-ing in the new letter,
and masking to 20 bits — a rolling hash with no collisions.
Examples
solve("AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT") → ["AAAAACCCCC","CCCCCAAAAA"]
solve("AAAAAAAAAAAAA") → ["AAAAAAAAAA"]
solve("ACGT") → []Sample tests