Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
XOR count solution in Clear category for The Hamming Distance by bryukh
#For binary numbers the Hammind Distance is "XOR" for them
#Use this this operation, convert it in binary form and count unities
def checkio(n, m):
"""
Calculate the hamming distance for n and m
"""
return bin(n ^ m).count("1")
Feb. 22, 2014
Comments: