← All problems

Number of 1 Bits

easy

Given an unsigned integer n, return the number of 1 bits in its binary representation (the Hamming weight).

Example

Input: n = 11        // binary 1011
Output: 3
Loading...