TLE. Could somebody tell me why ?


  • 0

    '''
    def retValue(self,c):
    for x in c:
    if c[x]!=0:
    return False
    return True
    '''

    '''

    def findAnagrams(self, s, p):
        out=[]
        for x in range(len(s)-len(p)+1):
            dictp=Counter(p)
            dicts=Counter(s[x:x+len(p)])
            dictp.subtract(dicts)
            dicttp=dict(dictp)
            if self.retValue(dicttp): #retValue says whether dicttp has all values equal to 0
                out.extend([x])
        return out
    

    '''


Log in to reply
 

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