Minimum Operations to Reduce an Integer to 0
Asked at Salesforce · Coding Questions · Difficulty: Medium · Last asked Apr 3, 2026
Given a non-negative integer `n`, you may repeatedly change it by adding or subtracting a power of 2. Return the minimum number of such operations needed to make the value exactly 0.
Loading the problem…
More Salesforce interview questions
- Campaign Cost Weekly Partition
- Design a Collaborative Spreadsheet (Google Sheets)
- AI / ML Fundamentals Oral Round (AI Engineer)
- Rate Limiter for Expensive API with User-Configurable Monthly Quota
- Hiring Manager + Behavioral Rounds
- Design an Async Job / Task System