Loading...
Loading...
Loading...
A feature-flag service stores its flags in one non-negative integer. Print how many flags are on, which means how many 1 bits the number has.
Example
Input
13
Output
3
13 is 1101, which has three 1 bits.
Try the problem first. Open one hint at a time.
Python has a method on integers that counts 1 bits.
Or count the "1" characters in bin(n).
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor