Back to the 100
Problem 008Bit Manipulation
Easy

Number of 1 Bits

008

Return the number of set bits in the unsigned binary representation of n.

EXAMPLES

Example 1
Input
{
  "n": 11
}

Output
3

FUNCTION SHAPE

n: intint
00:00
4 local tests readyRun with ⌘/Ctrl + Enter. Your code stays in this browser.

Runs solve(...) locally in a browser worker. SWE Playbook does not submit your code. Only run code you trust; Python code may access the network.