It is all about interview puzzles and HR questions .

Saturday, 31 March 2018

The king and 1000 bottle of wine


Puzzle :-

A king has 1000 bottles of very expensive wine. One of the bottle got poisoned accidentally. Unfortunately, the king does not know which bottle of wine is poisoned . The king decided to use 10 prisoner as taste tester to find the poisoned bottle. The effect of poison is seen only after 24 hours. The king only has 24 hours to find the poisoned bottle.
How can king do this?

Understanding of the puzzle.

We have 1000 bottles of wine, one of which is poisoned and we need to test all of the wine bottles using only 10 prisoners.
We have  only 24 hour to test the wine since effect of prisoner wine is observable only after 24 hours.
There is not enough time nor enough prisoner to test the wine one by one.
Hint :
Number each of the bottle from 1 to 1000.
Write the binary number representation of each bottle corresponding to it's number.
log 1000 with base 2 =9.96=10 (we have enough prisoner)
Answer : -
Assign each prisoner as a placeholder in the binary numbers so formed.
Prisoner 1 is assigned binary place 1
Prisoner 2 is assigned binary place2
Prisoner 3 is assigned binary place3
And so on...
Each prisoner will taste the wine from the bottle if the number on the at the binary place assigned to him is 1 otherwise if it is 0,he doesn't take a sip.
Example consider a bottle number 427
binary form of 427 is 0110101011
 Wait for 24 hours .
If 1st,2nd,4th,6th,8th and 9th prisoner died it means bottle no. 427 is poisoned.
Consider another case:
When  3rd,5th,6th and 8th prisoner Died. It means poisoned bottle would be :
10  9  8  7  6  5  4  3  2  1
 0   0  1  0  1  1  0  1  0  0
0010110100=180
Hence 180th bottle is poisoned. 

0 comments:

Post a Comment

Popular Posts

Recent Posts

Categories

Unordered List

Join Us On Facebook

Please Wait 10 Seconds...!!!Skip

Text Widget

Blog Archive

Search This Blog

Powered by Blogger.

like us on facebook

Who is the man?

Puzzle :- Brother and sisters is have none but this man's father is my father's son? Who is the man? Answer :- The man is my ...

http://go.oclaserver.com/afu.php?zoneid=1633049