The TransCompilator

Solved LeetCode program · 170 of 1,000

#0191 · Number of 1 Bits

Easy Bit Manipulation chunk-04.md

Original English source

The number is 11. The value is number. The count is 0.
Repeat while value is more than 0.
The bit is bitwise and of value and 1. Add bit to count. Set value to shift value right by 1.

Show count.

Open in Playground Browse all 1,000 problems

Expected stdout

3