PRIMEBIT EDITORIAL.
Problem Link:- PRIMEBIT
SETTER : @arpitgupta16
Editorialist : @arpitgupta16
Difficulty : Easy
Pre-Requisites : binary number system, bitwise operator.
EXPLANATION : Here we had to find sum of positions of set bits in the given number. For this we will check each bit of number and if the bit is set-bit we will add the position of that bit in the answer. Finally print the answer.
e.g. 19 == 10011.
output = 4+1+0 = 5.
Setter’s and Editorialist’s Solution:
Setters and Editorialists Solutions.
Hope you liked it and feel free to share any approach or ask any doubts in comments below. Other optimal solutions are encouraged too.