Short concise easy python solution


  • 0
    I
    class Solution(object):
      def findRepeatedDnaSequences(self, s):
        sequence, res= set(), set()
        for i in range(len(s)-9):
            res.add(s[i:i+10]) if s[i:i+10] in sequence else sequence.add(s[i:i+10])
        return list(res)

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.