Python 3 liner (97%, 46ms)


  • 0
    F
        def getHint(self, secret, guess):
           
            b = sum([min(guess.count(i), secret.count(i)) for i in set(secret)])
            a = sum([i==j for i, j in zip(guess, secret)])
    
            return '%sA%sB' % (a, b-a)
    

Log in to reply
 

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