You have 3000 bananas and a camel. You wish to transport the bananas to a place 1000 miles away, using only the camel as the mode of transportation.
The camel can only carry a maximum of 1000 bananas at a time, and will eat one banana every mile it travels. The camel will not go anywhere if it does not have any bananas.
You can load and unload as many bananas as you want anywhere. What is the maximum number of bananas that can be transferred to the destination using only the camel?
The maximum number of bananas that can be transferred is 533.
If we transport 1000 bananas at a time, the camel will consume all the bananas by the time it reaches the destination. So, we need to have intermediate drop points, the camel can then make several short trips in between.
To be optimal, we try to maintain the number of bananas at each point to be a multiple of 1000, as that’s the maximum of bananas the camel can transport at any point of time.
3000 x km 2000 y km 1000 z km
To go from source to IP1 point camel has to take a total of 5 trips, 3 forward and 2 backwards, since we have 3000 bananas to transport.
The same way from IP1 to IP2 camel has to take a total of 3 trips, 2 forward and 1 backward, since we have 2000 bananas to transport.
From IP2 to destination we only have 1 forward move.
Let’s see the total number of bananas consumed at every point.
- From the source to IP1 its 5x bananas, as the distance between the source and IP1 is x km and the camel had 5 trips.
- From IP1 to IP2 its 3y bananas, as the distance between IP1 and IP2 is y km and the camel had 3 trips.
- From IP2 to destination its z bananas.
We can now calculate the distance between the points:
- 3000 – 5x = 2000 so we get x = 200
- 2000-3y = 1000 so we get y = 333.33 but here the distance is also the number of bananas and it cannot be fraction so we take y = 333 and at IP2 we have the number of bananas equal 1001, so its 2000-3y = 1001
- So the remaining distance to the market is 1000 – x – y = z i.e 1000-200-333 = z = 467.
From IP2 to the destination point, the camel consumes 467 bananas and 533 bananas remain.