题解 | 重复的DNA序列
重复的DNA序列
https://www.nowcoder.com/practice/fe9099e5308042a8af2f7aabdb3719fe
class Solution:
def repeatedDNA(self, DNA: str) -> List[str]:
result = []
n = len(DNA)
for i in range(n - 9):
substring = DNA[i:i+10]
if substring in DNA[i+1:] and substring not in result:
result.append(substring)
return result
