Friday 9 February 2018

PUZZLE

1.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 about 1000 kilometer. So he decided to take his camel to carry the bananas. The camel can carry at the maximum of 1000 bananas at a time, and it eats one banana for every kilometer it travels.
What is the most bananas you can bring over to your destination?
Answer 533 Banana
First of all, the brute-force approach does not work. if Camel start by picking up the 1000 bananas and try to reach point B, then Camel will eat up all the 1000 bananas on the way and there will be no banana left for the Camel to return to point A.So we have to take an approach that Camel drop the bananas in between and then return to point A, to pick bananas again.
Since there are 3000 bananas and camel can only carry 1000 bananas, Camel will have to make 3 trips to carry them all to any point in between.
When bananas are reduced to 2000 then Camel can shift them to another point in 2 trips and when the number of bananas left are
In the first part, P1, to shift the bananas by 1Km Camel will have to

No comments:

Post a Comment