Simple, clear, beat 89% python code


  • 0
    S

    I just don't understand why the bit manipulate implementation has so many vote, and there is no Python voted most at first page for reference.
    My string implementation still beat 89% Pythonsumbmissions

    class Solution(object):
        def findRepeatedDnaSequences(self, s):
            """
            :type s: str
            :rtype: List[str]
            """
            one = set()
            repeat = set()
            for i in range(len(s)-9):
                ten = s[i:i+10]
                if ten in one:
                    repeat.add(ten)
                else:
                    one.add(ten)
            return list(repeat)

Log in to reply
 

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