# Number of 1 Bits

Try to solve the Number of 1 Bits problem.

We'll cover the following

## Statement

Write a function that takes a 32-bit binary representation of an integer $n$ and returns the count of its $1$ bits.

The binary representation of an integer is a sequence of $0$s and $1$s that represents the integer's value using base-2 notation. An example of the 32-bit binary representation of integer $13$ is $00000000000000000000000000001101$.

Constraint:

• The input must be aÂ 32-bit binary representationÂ of the integer.

Note: In languages like Python, there is an option to use unsigned integerThe unsigned integers can only be positive or zero, and they don't have a sign bit. type as the input type, so the input type is an unsigned interger. However, in Java, there is no built-in unsigned integer type, so the input type is a signed integer. In this lesson, we have displayed it as a string of binary numbers solely for visualization purposes.

## Examples

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.