noob solution


  • 0
    C
    def hammingDistance(x, y):
    binary_ex_or = str(bin(x ^ y)[2:])
            count = 0
            for bit in binary_ex_or:
                if bit == '1':
                    count += 1
                    
            return count
    

Log in to reply
 

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