Binary Numbers

Calculate and return number of 1s in binary representation of given number n.

Input format :
Integer n
Output Format :
In one line print the total number of 1s which satisfy above description
Constraints :

1 <= n <= 2^63 - 1

Sample Input :
 4
Sample Output :
 1
Sample Input Explanation :

4 can be represented as 100 in binary, which has only one 1 in binary representation.

Comments

Popular posts from this blog

How to pass parameters in webhook?

Access and modify all the resources of our Wiki.js using WikiJS API

Fahrenheit to Celsius