46ms python solution


  • 0
    W
    def hammingDistance(self, x, y):
        z = x^y
        res = 0
        for i in range(31):
            res += ((0x00000001<<i)&z)>>i
            
        return res

Log in to reply
 

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