Minimum Operations to Reduce N to Zero (±2^i)
Asked at Uber · Coding Questions · Difficulty: Medium · Last asked Apr 1, 2026
Given a positive integer `n`, on each operation you may add or subtract `2^i` (for any non-negative integer `i`) from `n`. Return the minimum number of operations needed to reach 0.
Loading the problem…