https://oj.leetcode.com/problems/repeated-dna-sequences/
class Solution:
# @param s, a string
# @return a list of strings
def findRepeatedDnaSequences(self, s):
map2Int = {'A':0, 'C':1, 'G':2, 'T':3}
lst = []
hah = {}
if len(s) <= 10: return lst
current = 0
for i in range(10):
current = current * 4 + map2Int[s[i]]
hah[current] = False
base = 4 ** 9
for i in range(10, len(s)):
current = (current - map2Int[s[i - 10]] * base) * 4 + map2Int[s[i]]
if current not in hah:
hah[current] = False
elif hah[current] == False:
hah[current] = True
lst.append(s[i - 9 : i + 1])
return lst