mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
12 lines
344 B
Python
12 lines
344 B
Python
|
class Solution:
|
||
|
def findRepeatedDnaSequences(self, s: str) -> List[str]:
|
||
|
seen = set()
|
||
|
results = set()
|
||
|
for i in range(len(s) - 9):
|
||
|
pattern = s[i:i+10]
|
||
|
if pattern not in seen:
|
||
|
seen.add(pattern)
|
||
|
else:
|
||
|
results.add(pattern)
|
||
|
return list(results)
|