Skip to content

Commit f2e5e1d

Browse files
authored
Hamming Distance
Initial File
1 parent 303aff9 commit f2e5e1d

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Hamming Distance

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def hammin_dist(x,y):
2+
count=0
3+
sol=x^y
4+
for i in range(32):
5+
if (sol>>i)&1 ==1:
6+
count=count+1
7+
8+
return count
9+
10+
print(hammin_dist(1,6))

0 commit comments

Comments
 (0)