July 4th Sale
Limited Time Deal: Unlock all premium questions for over 40% off
$10.42$6.25
10
:
09
:
32
:
00
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.
...