Problem
Return how many 1 bits there are in the binary form of the non-negative integer n (this count is called the Hamming weight).
Example 1
- Input
- n = 11
- Output
- 3
- Why
- 1011
Example 2
- Input
- n = 128
- Output
- 1
- Why
- 10000000
Example 3
- Input
- n = 2147483647
- Output
- 31
- Why
- thirty-one 1s
Constraints
0 <= n <= 2^31 - 1