Skip to content

Commit

Permalink
Merge pull request neetcode-gh#2381 from younessZMZ/main
Browse files Browse the repository at this point in the history
Create 0187-repeated-dna-sequences.py
  • Loading branch information
MHamiid authored Mar 30, 2023
2 parents f581e7d + d485556 commit ce787e2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions python/0187-repeated-dna-sequences.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Solution:
def findRepeatedDnaSequences(self, s: str) -> list[str]:
result = set()
previous_sequences = set()
for i in range(len(s) - 9):
current = s[i:i+10]
if current in previous_sequences:
result.add(current)
previous_sequences.add(current)
return list(result)

0 comments on commit ce787e2

Please sign in to comment.