Description
Solutions
Make Numbers Equal
🤘 INTERN📚RELATED PROBLEMS
There are two numbers number A and number B. Your task is to make A and B equal by doing few operations. In each operation:
Input Format:
Two spaced-separated integers A and B
Output:
Total cost
Example 1:
Input: A = 7, B = 9
Output: 5
Explanation:Operation 1: B > A so B = 9 - 7 = 2
Operation 2: A > B so A = 7 - 2 = 5
Operation 3: A > B so A = 5 - 2 = 3
Operation 4: A > B so A = 3 - 2 = 1
Operation 5: B > A so B = 2 - 1 = 1
A and B are equal so we stop cost = 5.
Constraints:
N/A

Related Problems
Testcase
Result
Case 1
input:
output: