Sponsored
Sponsored
Solve with full IDE support and test cases
Use these hints if you're stuck. Try solving on your own first.
If we want to make integer n equal to 0 by only subtracting powers of 2 from n, in how many operations can we achieve it?
We need at least - the number of bits in the binary representation of n, and at most - n.
Notice that, if it is possible to make num1 equal to 0, then we need at most 60 operations.
Iterate on the number of operations.