Number of 1 Bits
Write a function that takes the binary representation of an unsigned integer and returns the number of 1 bits it has (also known as the Hamming weight).
Number of 1 Bits

Write a function that takes the binary representation of an unsigned integer and returns the number of 1 bits it has (also known as the Hamming weight).

Example 1:
Input: 11
Output: 3
Input
arr =11

Count 1 bits

n

11

000028000024000020000016000012000080000410110

1-bits count: 0

Variables
VariableValue
n11
DepthFunction Call
Stack empty
0/5