VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » Knowledge, science, education » Logically Yours
YAHOO Interview Puzzle Camel and Bananas Logic + Optimization

YAHOO Interview Puzzle Camel and Bananas Logic + Optimization

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
YAHOO Interview Puzzle -- Camel and Bananas -- Logic + Optimization mastick: There-s a different way to look at the optimization. Instead of bouncing back and forth to point P to get 2, 000 bananas there, then from point P to point Q to get 1, 000 bananas there, I went with two home-to-cache trips. So, one trip to point P and back, one to Q and back, and then a one-way trip to market.
After the cache drop at point P, I-ll pass that point three more times - twice on the next cache drop, and once on the trip to market. So I-ll want to drop 3X bananas there. That way, I can maximize the camel-s load by reloading to 1, 000 on my way out to point Q, get bananas to make it back on the return from point Q, and then reload to 1, 000 on my final trip to market. So, 1, 000 = X + 3X + X = 5X, meaning X = 200.
For the cache drop at point Q, I-ll want to drop Y bananas so that on the trip to market, I can reload to 1, 000 when I get there (I-ll have picked up X bananas at point P. So, (200+Y) + Y + (200+Y) = 1, 400 or 3Y = 1, 000 or Y = 333. 333-
We-ll go with 333. 5 for that one. So, on the second cache drop, we load up with 1, 000 bananas, reach point P with 800, load 200 more to get to 1, 000 again, reach point Q with 666. 5 bananas (actually 667, but half of one is reserved, drop 333 and return to point P with the camel eating the last banana on arrival, and we load 200 to make it back home.
For the final trip to market, then, we load up with 1, 000 bananas, reach P with 800, load the last 200 bananas there to get to 1, 000 again, reach Q with 666. 5 (667 with half of one reserved, load up the 333 to get to 999. 5 (1, 000 with half of one reserved, and go the last 466. 5 miles to arrive with 533 bananas.

Date: 2023-11-15

Comments and reviews: 29


If you guys didnt understand here is the explanation.
3k bananas at starting point
1k banana max carry
The camel brought 1k forward to first drop point of 200km. It ate 200 bananas, thus it had 800 left, since it is going back to pick up the rest it had to take 200 from the 800, thus there are only 600 bananas at first drop off.
It then picked up 1k more bananas, dropped the same 600 since it has to go back the last time to pick the remaining 1k. Since it is no longer going back the 3rd time, then it had 800 to drop off. Totalling 2k bananas at first drop point.
The 2nd drop point, the camel carried 1k bananas again and made 333km, thus eating 333 bananas, and only having 667 bananas left, since it need to go back again to pick up the last 1k, it took 333 bananas, thus having 334 bananas on 2nd drop point. Once its picked up the 1k bananas, it consumed 333 of it again to get to drop point, thus having 667 to drop plus the remaining 334 to have 1001 bananas on 2nd drop point.
Now this is where it gets weird. The camel can only carry 1k bananas. Thus 1 banana is wasted. The camel then traveled 467km to drop of the remaining bananas to the market, resulting of 533 bananas delivered out of the 3000 in the beginning.

reply

666 Bananas is the answer I concluded.
Trip #1. Pick up 1000 Bananas, drop at the 667m point
333 Bananas dropped.
Trip #2. Pick up 1000 Bananas, drop at 667m point, now you have 666 bananas at the 667m point.
Trip #3. Pick up last 1000 Bananas, only 333 remain at 667m point, so pick up the remaining two bundles of 333 Bananas, now you are carrying 999 Bananas.
Continue to market with camel eating a further 333 Bananas, 999-333=666.
So I've just delivered 666 Bananas to market.
Please find a flaw in my logic, because I trust you, but My math says an additional 133 Bananas should have been delivered, so as your boss I would have to fire you for -Shorting Me-, and I like you, so I'd rather not have to fire you.

reply

I did find that answer, but it is wrong and shows the error of short-term thinking.
You see, the description does say that the camel needs to eat a banana for every km it travels. However, the math used assumes we're keeping the camel at starvation levels at all times. In practice we should probably feed the camel fully before the trip.
Now, I don't know how many bananas a camel can eat. If 1000, then it can deliver 1000 nanas to the market (it can't do more since the vectors would add up to 3000 consumed for 2 batches. It would have 1000 bananas left at home. If 2000, then the camel can get home.
If less, then we'd need the number to know how much can be carried.

reply

Ou, i didn't thought you only have 1 camel
If you could get 3, you would load all 3000 of those bananas and release a camel every 1000 bananas eaten, thus reducing camel upkeep cost
A fleet of 3 camels would consume 1 banana for equivelant kilometer, which translates to 3 banana/kilometer. Rounded down its about 333 Km before you mothball a camel and be left with 2000 bananas and 2 banana/camel upkeep. Giving an additional 500 km. Then you're left with 1 camel and 1000 bananas with only 167 kilometers to go. Arriving at the market with 833 bananas and 2 mothballed camel you can repair

reply

00: 06 Transport maximum bananas using a camel.
00: 45 The camel should make several short trips with intermediate drop points to optimize banana delivery
01: 30 To maximize the number of bananas, the camel needs to make five trips.
02: 12 Two forward trips with camels carrying 1000 bananas reduces output number.
02: 51 Optimize drop points for bananas transportation
03: 28 The camel's forward trip is determined by simple mathematics
04: 17 The distance between points P and Q is 333. 33 kilometers.
05: 02 A camel delivers 533 bananas to the market

reply

In the problem they have not mentioned minimum stops so why not stop for every 100 km in such a way you end up selling 800 bananas
for 1st 100kms we end up with three travels(up and down) which makes total bananas = 3000-300 = 2700
similarly for 2nd step we make 3 steps making total banas 2400 we loose 300 bananas till 1800 from here we only end up losing 200 bananas for 2 steps and finally we end up with 800 bananas in the end when we reach market.
Correct me if I am wrong

reply

A) Geez, find a closer market. B) My solution was to stop every km, keeping my bananas closer to hoof. After 200 km, can drop to 3 trips, and then around 533 down to 1, as you found. C) your Y value is a fraction of km but no one said you had to feed the camel exactly at the km marker. You can set your waypoint at 333 1/3 km, and you just turn around with 2/3 km before the camel wants a banana. D) This banana-guzzling camel is clearly not making it back to the plantation.
reply

I would say the answer is wrong. My calculation came out that there are 534 bananas which can be delivered. Given the first two calculations as correct there are 1001 bananas at intermediate point Q. So if you load 1000 bananas onto the camel and you're carrying the last banana by yourself. And after the first kilometer you feed the banana you hold on to the camel so it doesn't need to eat one of the bananas it is carrying. Therefore it is one banana more at the market
reply

If the camel eats the banana after and not before each km, it's not 533 bananas, it's 534. You can deny the camel the last banana and let it starve to death, so you have one more banana. No matter what your profit margin is, you can't buy enough new bananas to make it back anyways (because people would buy those cheaper bananas instead of your expensive bananas. The only possibility is if the camel also eats other fruits than bananas.
reply

Hm, it seems that you can actually deliver 666 bananas.
For a first stop you move for 666 km. After 3 rounds you will load 3 times 1000 bananas and deliver 3 times only 334 bananas at that checkpoint, thus at the end having 1002 bananas at the checkpoint.
Finally for the second segment you load all 1000 bananas (ignore the remaining 2) and go for remaining 334 km of distance. And voila! you have 666 bananas at the destination.

reply

The question doesn't make sense. It asks, -What is the maximum amount of bananas that can be delivered to the market with the help of the camel? -
It doesn't specify. Per trip? Out of 3000 bananas?
You can get 3000 bananas there regardless. You may lose a lot of bananas in the process and it may take a few trips, but you can still get 3, 000 bananas there.
The question is in specific enough.

reply

Wrong answer. Use 500km as the midpoint, drop 500x3, leaving 1500 at the midpoint. Then carry 1000 another 250 km, leaving 750 bananas behind at the 750km mark. Then go back and bring the remaining 500 bananas to the 750km mark. Now pick up, the remaining 750 bananas for a total of 1000 bananas with 250km to go. Now walk the remaining 250km and you arrive at the market with 750 bananas.
reply

750 bananas!
1. Take the first 1000 to the 500 km mark and drop 500 bananas.
2. Take the second 1000 to the 500 km mark and drop 500 bananas. -
3. Take the third 1000 to the 250 km from the market and drop 250 bananas. -
4. Go back and grab the 1000 at the 500 km mark.
5. Go pick up the 250 and deliver 750 the the market.

reply

With this kind of sloppy requirements, the answer is: You can sell all 3000 bananas. 1) Load 1000 bananas on the camel. Go 0. 9km and drop off all bananas. The camel hasn-t eaten any banana yet because it hasn-t gone 1 km yet. 2) Go back and fetch another 1000 bananas to the 0. 9km mark. 3) Repeat 2. 4) Repeat 1-3 1109 times. Easy -.
reply

I'm sorry but this is an incredibly weak explanation. The first intuition is ok, but the second one is completely arbitrary. If you're not going to do the full math and prove it, then you need better -intuitions- to base the solution on. You can't just arbitrarily say you're using 2 intermediate stops and assume that's optimal.
reply

Your premise is wrong. In the beginning you state you want to transport 3000 bananas to market, not you only have 3000 bananas, meaning the total number of bananas you start with could be any number. And if you goal is to get 3000 bananas to market than the maximum number that you can get to market is 3000.
reply

533 is one of the options. I don't have a full understanding why it is optimal.
What would the numbers be if we only had point P, or only had point Q, at appropriate distances? (that is, only 2000 or only 1000. I suspect by intuition that it is worse with fewer points, but did not confirm.

reply

It's an interesting approach, but the solution is not correct. The maximum number of bananas is 833
There is a wrong assumption that there should only be two intermediate points while there is no such limitation in the puzzle. It is more optimal to make a stop on every kilometer

reply

Per the rules of the puzzle. the camel takes loads of 1K bananas for trips of 0. 99km. The camel never reaches the 1km = 1 banana point throughout the entire trip, so all 3000 bananas make it to market (eventually. 3, 031 -trips- of 0. 99km each
reply

534 is the answer. Surely i can carry one banana for the last segment. Unless i too need to eat bananas, then based on the total distance i would need to eat more than the remaining bananas just to cover the calorie costs of walking so far.
reply

do you go with the camel aswell and eat nothing till you reach the market? or does camel make all the deliveries alone and gets signoff from the market (lets say payment credited online? what a ridiculous problem? math is so weird
reply

So just to sell 533 bananas you have to feed the camel nearly 2500 that's 5/6 of the starting amount talk about a terrible ROI, unless you're selling the bananas at a ridiculously high markup to cover the cost of feeding the camel.
reply

I thought the answer was 1. 000, because the puzzle don't say if the camel needs to eat the banana after or before walking a kilometer, so it will just eat 1. 000 in the beginning and carry 1. 000 while his stomatch was full.
reply

And then you leave the camel at the market because it won't receive the required amount of bananas to make a return trip, and your feet will feel painful after walking such a long distance back home from the market.
reply

If I did my math right that guy worked for about 62 cents per hour not including the time it took to plant, grow, and harvest them. Just rent a truck at that point. You-re costing yourself way too much money lol.
reply

Solved in my head without the -formulas- only applying logic in 45seconds. When you realize the camels full capacity should be utilized as much as possible then everything else is easy. Btw my IQ is 157.
reply

I thought the camel wouldn't need to eat for return points because he said eats or consumes which doesn't states that it requires so I came with another solution I might have solved it if I knew.
reply

Question isn-t worded correctly. Should be saying the camel REQUIRES 1 banana per km walked. Otherwise, it wouldn-t need 200 bananas on the trip back from first drop point etc.
reply

unclear explanation, i assumed the camel eats zero bananas when traveling back as it doesnt carry any bananas and might eat something else when arriving at its origin.
reply
Add a review, comment






Other channel videos