My accepted python solution


  • 0
    X
    class Solution:
        # @param {string} s
        # @return {string[]}
        def findRepeatedDnaSequences(self, s):
            d = {}
        	res = []
        	for i in range(len(s)):
        		key = s[i:i+10]
        		if key not in d:
        			d[key] = 1
        		else:
        			d[key] += 1
    
        	for e in d:
        		if d[e] > 1:
        			res.append(e)
    
        	return res

  • 0
    L

    I think it is wrong

    Expected:

    Solution().findRepeatedDnaSequences("AAAAAAAAAAAA")
    []
    Yours:

    Solution().findRepeatedDnaSequences2("AAAAAAAAAAAA")
    ['AAAAAAAAAA']


Log in to reply
 

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