mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 187.py
This commit is contained in:
parent
56532f8280
commit
ba0e3702f3
11
LeetCode/187.py
Normal file
11
LeetCode/187.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
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)
|
Loading…
Reference in New Issue
Block a user