
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Binary search the answer.
In each step of the binary search you should calculate the number of the set bits in the <code>i<sup>th</sup></code> position. Then calculate the sum of them.