func hammingWeight(n int) int { var w int for ;n!=0; { if n%2==1 { w++ n-- } else { n /= 2 } } return w }