Practice Count Operations to Obtain Zero
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given two non-negative integers num1 and num2. In one operation, if num1 >= num2, you must subtract num2 from num1, otherwise subtract num1 from num2. Return the number of operations required to make either num1 = 0 or num2 = 0.
Source: Count Operations to Obtain Zero on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
num1 = 2, num2 = 3
Output
3
# Example 2
Input
num1 = 10, num2 = 10
Output
1
Constraints
0 <= num1, num2 <= 10^5
Related LeetCode Problems
Practice more problems similar to Count Operations to Obtain Zero.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.