Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Naive solution in Clear category for The Hamming Distance by obone
def checkio(n, m):
m, n = sorted((m, n))
ms, ns = bin(m)[2:], bin(n)[2:]
ms = '0' * (len(ns) - len(ms)) + ms
# return sum(a != b for a, b in zip(ms, ns))
counter = 0
for a, b in zip(ms, ns):
counter += (a != b)
return counter
Oct. 10, 2019
Comments: