Spring Hire Sale
Limited Time Deal: Unlock all premium questions for over 30% off
$10.42$7.08
08
:
04
:
59
:
44
Back to Dashboard
Binary Step Reduction
Medium
You are given a positive integer n. Your goal is to reduce it to zero using the fewest operations possible.
In a single operation, you may add or subtract any power of two (for example, 1, 2, 4, 8, 16, ...). The value of n may temporarily become negative during the process.
...