Puzzle : A better solution to king’s wine cellar


Sometimes it happens that you are so much biased to think in one direction that you forget to think that a simpler and better solution might exist from a different direction. I am referring to my post on the king’s wine cellar.

One of my friend Sameer has suggested a very simple and a better solution based on hamming code.

For example, in our case we had 100 wine barrels. Let us number them from 0 to 99. Now, if we convert these numbers into binary, we need 7 bits to represent them. Thus, we need only 7 servants to be put on stake when we want to find out a poisonous wine barrel.

So if 58th wine barrel is poisonous, binary equivalent will be 0111010, so from the right, second, fourth, fifth and sixth servant would have drank from that barrel (because of ‘1’ in those positions) and would have died.

How silly of me not to think about this solution!!!

–Saurabh Joshi


Tags: ,

One Response to “Puzzle : A better solution to king’s wine cellar”

  1. Mgccl Says:

    Very smart, increases my skillz. This should be the most optimal solution… for least servants.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: