diff --git a/LeetCode/187.py b/LeetCode/187.py new file mode 100644 index 0000000..c7da0d7 --- /dev/null +++ b/LeetCode/187.py @@ -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)