HammingDistance
Calculates the Hamming distance between two values.
- Use the XOR operator (
^
) to find the bit difference between the two numbersand convert to a binary string usingfmt.Sprintf()
with"%b
. - Count and return the number of
1
s in the string, usingstrings.Count()
.