Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2571. Minimum Operations to Reduce an Integer to 0
Given n, you may add or subtract any power of two per operation; find the minimum number of such operations to reach 0. The core challenge is choosing when to propagate carries (increment) versus decrementing to eliminate runs of 1s in n's binary representation, solvable by a greedy/DP strategy over the bits.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.