Question: There is an infinitely long straight road. There will be infinitely many trees of each kind. (apple trees, kiwi trees, and grape trees) Trees of

There is an infinitely long straight road. There will be infinitely many trees of each kind. (apple trees, kiwi trees, and grape trees) Trees of each kind will be placed along the entire road in regular intervals. More precisely, you are given apples, kiwi, and grapes with the following meaning: The distance between any two consecutive apple trees must be apples, the distance between any two consecutive kiwi trees must be kiwi, and the distance between any two consecutive grape trees must be grape. One can only plant the trees at integer coordinates, but he/she gets to choose those coordinates as long as the above conditions are satisfied. In other words, gets to choose three integers x, y, and z such that: - he plants apple trees at coordinates ..., x - 2 * apple, x - apple, x, x + apple, x + 2 * apple, ... - he plants kiwi trees at coordinates ..., y - 2 * kiwi, y - kiwi, y, y + kiwi, y + 2 * kiwi, ... - he plants grape trees at coordinates ..., z - 2 * grape, z - grape, z, z + grape, z + 2 * grape, ... he wants to maximize the distance between two closest trees (of any kind). Return this distance. Note - easier to get distance with gcd, but i not able to relate logic. If possible can you explain why GCD helps here with illustration of some example. Or just explain how i can tackle this programatically.

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 Accounting Questions!