# Camel and Bananas Puzzle || Solution Explained

Puzzle Detail: “The owner of a banana plantation has a camel. He wants to transport his 3000 bananas to the market, which is located after the desert. The distance between his banana plantation and the market is about1000 Kilometer. So he decided to take hiscamel to carry the bananas. The camel can carry at the maximum of1000 bananas at a time, and iteats one banana for every kilometerit travels.”

What are the most bananas you can bring over to your destination?

Take your time to solve this puzzle before checking the solution. Check our video for the solution.

**Detailed Explanation:**

This is more of logical thinking, let’s assume banana plantation location is point A and the market point is point B.

< — p1 →< — — –p2 — –>< — –p3 — ->

A — — — — — — — — — — — — — ->B

First of all, the brute-force approach does not work. Think that If the Camel starts by picking up the 1000 bananas from point A and tries to reach point B, then he will eat up all the 1000 bananas on the way and there will be no bananas left for him to return to point A.

So we have to take an approach that the Camel drops the bananas in between say point P1, and then returns to point A to pick up the remaining bananas again.

Since there are 3000 bananas and the Camel can only carry 1000 bananas, he will have to make 3 trips to carry them all to any point in between. Every time camel has to carry 1000 bananas. when bananas reduced to 2000 and the Camel can only carry 1000 bananas, he will have to make 2 trips to carry them all to any point in between. When the number of bananas reduced to <= 1000, then he should not return and only move forward.

In general when bananas are 3000 then the Camel can shift them to another point in between Point A and Point B in 3 trips. When bananas are reduced to 2000 then the Camel can shift them to another point in 2 trips and when the number of bananas left are <= 1000, then he should not return and only move forward.

**step1: In step 1****the Camel will have to,****Move forward with 1000 bananas — Will eat up 1 banana on the way forward since the condition in the puzzle says that “camel****eats one banana for every kilometer it travels.”****step 2:****In step 2****the Camel will have to,****Leave 998 banana after 1 km and return with 1 banana — will eat up 1 banana on the way back**,**since the condition in the puzzle says that “camel****eats one banana for every kilometer it travels.”****step 3:****In step 3****the Camel will have to,****Pick up the next 1000 bananas and move forward — Will eat up 1 banana on the way forward****step 4: In step 4****the Camel will have to,****Leave 998 banana after 1 km and return with 1 banana — will eat up 1 banana in the way back****step 5:****In step 5****the Camel****Will carry the last 1000 bananas from point A and move forward — will eat up 1 banana**.

Note: After step 5 the Camel does not need to return to point A again because all bananas are shifted to point p1. So to shift 3000 bananas by 1km, the Camel will eat up 5 bananas. After moving to 200 km the Camel would have eaten up 1000 (200*5 = 1000) bananas and is now left with 2000 bananas. Now in the second Part, say point P200 and from point P200 the Camel needs to do the following to shift the Bananas by 1km to point Q1.

**step1:****In step 1****the Camel will have to,****Move forward with 1000 bananas — will eat up 1 banana on the way forward**.**step2:****In step 2****the Camel will have to,****Leave 998 bananas after 1 km and return with 1 banana — will eat up this 1 banana on the way back****step3:****In step 3****the Camel will have to,****Pick up the next 1000 bananas and move forward — Will eat up 1 banana in the way forward**

Note: After step 3 the Camel does not need to return to the starting point of P200. So to shift 2000 bananas by 1km, the Camel will eat up 3 bananas. After moving to approximately 333 km (333*9 = 999) the camel would have eaten up 1000 bananas and is now left with the last 1000 bananas.

The Camel will actually be able to cover 333.33 km, we have ignored the decimal part because it will not make a difference in this example. Hence the length of part 2 is 333 Km. Now, for the last part, that is part 3, the Camel only has to move forward. He has already covered 533 (200+333 ) out of 1000 km in Parts one and two.

Now he has to cover only 467 km (1000–533) and he has 1000 bananas. He will eat up 467 bananas on the way forward, and at point B the Camel will be left with only 533 Bananas.

let’s summarize with 3 simple stages:

- With 3000 bananas, Camel requires 5 bananas for each kilometer. This happens till the point Camel has 2000 bananas [ for A(0)->B(1)->A(1)->B(1)->A(1)->B(1) = 5 bananas ] Camel will have 2000 bananas at 200th Kilometer.
- From now on, it requires 3 bananas for each kilometer. This happens till the point Camel has 1001 bananas [ for A(0)->B(1)->A(1)->B(1) = 3 bananas ]Camel will have 1001 bananas at 533rd kilometer.
- From now on it requires 1 banana for each kilometer. [ Now here you may wish to send back your Camel from 534th->533rd km just to eat 1 banana if you don’t want to waste it, else continue with 1000 bananas. Nevertheless, it doesn’t make any difference whether you send or not ]. At 534th kilometer, Camel will have 999 bananas. This will end up having 533 bananas at 1000th kilometer (of course after Camel consuming 1 banana here )