187. Repeated DNA Sequences
https://leetcode.com/problems/repeated-dna-sequences/
Python
Sliding Window with hashmap memory
class Solution:
def findRepeatedDnaSequences(self, s: str) -> List[str]:
seem = set()
ans = set()
for i in range(len(s)-10+1):
sequence = s[i:i+10]
if sequence in seem:
ans.add(sequence)
seem.add(sequence)
return list(ans)