由于今天做了周赛,每日一题就简单点直接暴力哈希
class Solution:
def findRepeatedDnaSequences(self, s: str) -> List[str]:
d = defaultdict(int)
ans = []
for i in range(len(s) - 9):
t = s[i: i + 10]
d[t] += 1
if d[t] == 2:
ans.append(t)
return ans