Back to DSA sheet

Number of 1 Bits

EasyBit Manipulation
Open on LeetCodeAmazonGoogle

Return the number of set bits (Hamming weight) in the binary representation of an unsigned integer.

Constraints
  • The input is a 32-bit unsigned integer
Sheets
Blind 75Grind 75NeetCode 150NeetCode 250
number-of-1-bits.cpp
Loading editor
Custom input (stdin)
Output

Run your code to see its output.