problem link:
Discuss: in this problem you just simply convert decimal to binary. then count the number of one's in binary that will be the 'P'. and for converting you can use c++ built in STL string binary = std::bitset<31>(n).to_string(); . and there is no tricky part in this problem.
try yourself, before see the code
Discuss: in this problem you just simply convert decimal to binary. then count the number of one's in binary that will be the 'P'. and for converting you can use c++ built in STL string binary = std::bitset<31>(n).to_string(); . and there is no tricky part in this problem.
try yourself, before see the code