A DNA string uses the letters A, C, G, T. Return all 10-letter sequences that occur more than once in s (overlapping occurrences count), each listed once, in dictionary order.
For "AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT" the answer is ["AAAAACCCCC", "CCCCCAAAAA"].
The starter code counts every sequence by scanning the whole string. It is correct but too slow for long strings.
Example 1
Input:
repeated_dna('AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT')
Output:
['AAAAACCCCC', 'CCCCCAAAAA']
Example 2
Input:
repeated_dna('AAAAAAAAAAAAA')
Output:
['AAAAAAAAAA']
0 <= len(s) <= 100000s contains only A, C, G, T.No results yet
Run your code to check it against the examples, or submit to run every test.