You are given two non-negative integers num1 and num2. In one operation, if num1 >= num2 you subtract num2 from num1, otherwise you subtract num1 from num2. Return the number of operations needed until num1 = 0 or num2 = 0.
You are given two non-negative integers num1 and num2. In one operation, if num1 >= num2 you subtract num2 from num1, otherwise you subtract num1 from num2. Return the number of operations needed until num1 = 0 or num2 = 0.
Example 1:
Input: {"num1":2,"num2":3}
Output: 3
Constraints:
0≤num1,num2≤105
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"num1":2,"num2":3}
Draw a 2 by 3 rectangle. One operation subtracts the smaller side from the larger, which is the same as cutting a square off the rectangle.