Practice Minimum Operations to Make the Integer Zero
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Medium#2749
LeetCode ProblemMinimum Operations to Make the Integer Zero
Problem Statement
In one operation, choose an integer i from 0 through 60 inclusive and subtract 2^i + num2 from the current num1. Return the minimum operations that make num1 equal to 0, or -1 if impossible.
Source: Minimum Operations to Make the Integer Zero on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
num1 = 3, num2 = -2
Output
3
# Example 2
Input
num1 = 5, num2 = 7
Output
-1
Constraints
1 <= num1 <= 10^9
-10^9 <= num2 <= 10^9
Related LeetCode Problems
Practice more problems similar to Minimum Operations to Make the Integer Zero.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.