https://leetcode.com/problems/repeated-dna-sequences/description/
The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'.
- For example, "ACGAATTCCG" is a DNA sequence.
When studying DNA, it is useful to identify repeated sequences within the DNA.
Given a string s that represents a DNA sequence, return all the 10-letter-long sequences (substrings) that occur more than once in a DNA molecule. You may return the answer in any order.
class Solution:
def findRepeatedDnaSequences(self, s: str) -> List[str]:
result = set()
store = set()
for start in range(len(s)):
end = start + 10
trim = s[start:end]
if trim in store:
result.add(trim)
else:
store.add(trim)
return list(result)'algo > leetcode' 카테고리의 다른 글
| 5. Longest Palindromic Substring (2) | 2024.10.20 |
|---|---|
| 2091. Removing Minimum and Maximum From Array (4) | 2024.10.14 |
| 207. Course Schedule (0) | 2024.10.13 |
| 49. Group Anagrams (1) | 2024.10.13 |
| 2007. Find Original Array From Doubled Array (0) | 2024.08.21 |