This answer seems wrong


  • 0
    C

    This is my solution

    class Solution(object):
    def findRepeatedDnaSequences(self, s):
        output=set()
        p=''
        X=len(s)
        rest=set()
        for i in range(0,X-10):
            p=s[i:i+10]
            if p in rest:
                output.add(p)
            else:
                rest.add(p)
                
        return list(output)
    

    However for this input ["AAAAAAAAAA"] . The compiler returns "AAAAAAAAAAA" as an answer. However since it's only 10 characters there are no duplicates. Is this a mistake in the question?


Log in to reply
 

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