Question: Given two boxes of chocolate containing A and B chocolates representing the number of chocolates Alex and Drake have, respectively. Drake is the younger child

Given two boxes of chocolate containing A and B chocolates representing the number of chocolates Alex and Drake have, respectively. Drake is the younger child and will only be happy if he receives a multiple of what Alex gets. You decided to buy some extra chocolates.
Mathematically, The share of chocolates will be:
k*(A+X)=(B+ Y) for some non-negative integer X and Y and some positive integer k
What is the minimum number of extra chocolatesX+Y) that you need to buy?
Note: The original chocolates (A and B) cannot be transferred among each other.
Function description
Complete the function solution. The function takes 2 parameters and returns the solution:
A: Represents the number of initial chocolates in Alex's box
B. Represents the number of Initial chocolates in Drake's box
Input format for custom testing
Note: Use this input format if you are testing against custom input or writing code in a language where we don't provide boilerplate code
Next

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!