Write a function that takes a non-negative integer n and returns the number of 1 bits it has in its binary representation (also known as the Hamming weight).
Example
n = 11 (1011) => 3
n = 128 (10000000) => 1
function HammingWeight(n: int) -> int
Found a bug? Or annoyed about something in the language? Tell us.