Morgan Stanley Interview Question
Development Support EngineersI think Anonymous on January 26, 2011 is correct. Just repeat:
1. Prince in one basket and stone in the other. Prince down. Stone up. Prince stays on the ground. Leave the stone at the top.
2. King in one basket and Queen plus stone in the other. King down. Queen and stone up. King stays on the ground. Queen and stone at the top.
3. Queen in one basket and prince in the other. Queen down. Prince up. Queen stays on the ground. Prince at the top.
4. Prince in one basket and stone in the other. Prince down. Stone up. Prince stays on the ground.
Prince goes down alone. Then Queen and stone in one basket, and king in other, King will reach down. Remove stone, and Prince climbs in. in one, Queen in other. Queen will reach down, Prince will go up. Now stone in one basket, Prince in other, Prince will reach down. :)
I think you have to assume that initially the one bucket is empty and sitting at the top of the pulley, and the other is on the ground with the stone in it. When the prince goes down, you just can't say that you then put the queen and stone in one bucket and the king in the other, because one bucket is always on the ground.
1. King in basket1 (78) and queen + stone (72) in basket2 ... king goes down
2. Queen in basket1 (42) and prince in basket2 (36) ... queen goes down
3. Prince in basket1 (36) and stone (30) in basket2 ... prince goes down
This solution is ignoring the initial condition. The stone is in one of the baskets. This basket must be at the bottom so no one can immediately get in the basket with the stone.
hey why bother about the stone?
keep the king (78kg) in one basket and in another basket queen(42kg) and prince(36kg) that is 42+36=78.
The weight is equal so there is no problem :)
Since one of the baskets got 30 kg stone, it is at the ground. Following sequence will bring all 3 down:
1. Prince (36 kg) gets into basket, it will come down to ground and basket with 30 kg stone will reach top.
2. King unloads stone and queen gets in, basket with prince (36 kg) will come to top and queen (42 kg) on ground. Queen stays on ground.
3. King (72 Kg) gets into one basket, prince and stone (36kg + 30kg) in the other. King reaches safely. Now both king and queen are on ground.
4. Prince changes basket. He comes down as other basket got 30 kg rock.
All 3 reach ground safely.
Assume that basket with stone is at bottom (basket2), and empty one is at top (basket1)
1. Queen in basket1, goes down. Basket2 will goto top. Queen land in the ground, so basket2 will come down. Now queen will get into basket 2 (30kg + 42kg).
2. King (78 kg) will get into basket1 and comes down. King will land in the ground. Basket2 will come down, so queen can also land in the ground.
3. Prince get into the basket1 and comes down.
I believe the solution is as follows (assume initial configuration to be an empty bucket at the top and a bucket with the stone in it at the bottom):
- Frank January 28, 20111. Prince goes down, rock goes up.
2. Queen goes down, Prince goes up.
3. (the rock is dropped from the top of the tower)
4. King goes down, Queen and rock go up.
5. (the rock is dropped from the top of the tower)
6. Prince goes down, rock goes up.
7. Queen goes down, Prince comes up.
8. (the rock is dropped from the top of the tower)
9. Prince goes down, rock goes up.