Table of contents | |
Introduction | |
Approach 1 | |
Approach 2 | |
Conclusion |
A person needs to transport 3000 bananas to a destination 1000KMs away using only a camel as a mode of transportation. However, the camel can only carry a maximum of 1000 bananas at a time and eats a banana every km it travels. So how many bananas can be transported to the destination
At first, it seems like all the bananas will be eaten by the camel before reaching the destination. But the trick is to have intermediate drop points. So, we can have two drop points and make several short trips in between. We need to maintain the number of bananas at each point to be a multiple of 1000. With 3000 bananas at the source, we can have 2000 at the first intermediate point and 1000 at the second intermediate point. The camel will need to take a total of 5 trips from the source to the first intermediate point, 3 trips from the first intermediate point to the second intermediate point, and 1 trip from the second intermediate point to the destination. The total number of bananas consumed at each point can be calculated using the distance between the points and the number of trips taken. Finally, we get 533 bananas transferred to the destination.
If the camel doesn't eat a banana while returning, we can transport more bananas. We can divide the journey into three parts. First, the camel takes 1000 bananas and travels 333KMs and leaves 667 bananas at the first intermediate point. Then, it returns to the source. Two more times, the camel takes 1000 bananas and travels for 333KMs and leaves the remaining bananas at the first intermediate point. Now, we have 2001 bananas at the first intermediate point. The camel takes 1000 bananas and travels for 500KMs and leaves 500 bananas at the second intermediate point. Then, it returns to the first intermediate point. Again, the camel takes 1000 bananas and travels for 500KMs and leaves the remaining bananas at the second intermediate point. Now, we have 1000 bananas at the second intermediate point. Finally, the camel takes 1000 bananas and travels the remaining 167KMs to reach the destination. Thus, we can transport a maximum of 833 bananas to the destination if the camel doesn't eat a banana while returning.
By using intermediate drop points and calculating the number of trips and distance traveled, we can transport a maximum of 533 bananas using the camel. If the camel doesn't eat a banana while returning, we can transport a maximum of 833 bananas.
|
Explore Courses for Interview Preparation exam
|