Solution: Number of 1 Bits

Let's solve the Number of 1 Bits problem using the Bitwise Manipulation pattern.

Statement

Write a function that takes a 32-bit binary representation of an unsigned integer nn and returns the count of its 11 bits.

The binary representation of an unsigned integer is a sequence of 00s and 11s that represents the integer's value using base-2 notation. An example of the 32-bit binary representation of an unsigned integer 1313 is 0000000000000000000000000000110100000000000000000000000000001101. ...