Skip to content

Instantly share code, notes, and snippets.

@bcowell
Last active February 12, 2019 20:53
Show Gist options
  • Save bcowell/3243a1888e36de66cf8d38744edcde55 to your computer and use it in GitHub Desktop.
Save bcowell/3243a1888e36de66cf8d38744edcde55 to your computer and use it in GitHub Desktop.
hamming-distance
def hammingDistance(self, x, y):
xor = bin(x^y)
return xor.count("1")
@bcowell
Copy link
Author

bcowell commented Feb 12, 2019

Solution for leetcode 461. Hamming Distance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment