Number of 1 Bits

Easy
Math Bit Manipulation

Return the number of 1 bits (Hamming weight) of an unsigned integer.

Constraints

Input is a 32-bit unsigned integer

Examples

Example 1:
Input: 11
Output: 3
Explanation: 11 = 1011 in binary
Example 2:
Input: 128
Output: 1
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.