Friday 29 July 2005

weighting problem: classical

Classic Weighting (ref: http://www.techinterview.org/Puzzles/fog0000000046.html)

Problem: The evil king from before sends his own assassin to take care of the evil queen who tried to poison him. Of course, her trusty guards catch the assassin before any harm is done. The queen notices that the assassin is quite handsome and doesn't really want to punish him by death. She decides to test his wisdom.

The queen gives the assassin 12 pills which are all completely identical in shape, smell, texture, size, except 1 pill has a different weight. The queen gives the man a balance and tells him that all the pills are deadly poison except for the pill of a different weight. The assassin can make three weighings and then must swallow the pill of his choice. If he lives, he will be sent back to the bad king's kingdom. If he dies, well, thats what you get for being an assassin.

Only one pill is not poison and it is the pill which has a different weight. The assassin does not know if it weighs more or less than the other pills. how can he save his skin?

Solution:
Official solution

An easier version of this question is that you knew the non-poison bill is heavier (or lighter, similiar logic apply).

No comments: