func hammingDistance(x int, y int) int {
z := x^y
var count int
for{
res := z&1
if res == 1{
count++
}
z = z>>1
if z==0{
break
}
}
return count
}
func hammingDistance(x int, y int) int {
z := x^y
var count int
for{
res := z&1
if res == 1{
count++
}
z = z>>1
if z==0{
break
}
}
return count
}
本文标题:hamming distance
本文链接:https://www.haomeiwen.com/subject/vthqvttx.html
网友评论