- Prepare
All Platforms Programming Aptitude Syllabus Interview Preparation Interview Exp. Off Campus - Prime Video
- Prime Mock

- Interview Experience
- Prime VideoNew
- Prime Mock
- Interview Prep
- Nano Degree
- Prime Video
- Prime Mock

# King & Wine Bottle Puzzle

**Solve the King & Wine Bottle Puzzle**

You are the ruler of a medieval empire and you are about to have a celebration tomorrow. The celebration is the most important party you have ever hosted. You’ve got 1000 bottles of wine you were planning to open for the celebration, but you find out that one of them is poisoned.

The poison exhibits no symptoms until death. Death occurs within ten to twenty hours after consuming even the minutest amount of poison.

You have over a thousand slaves at your disposal and just under 24 hours to determine which single bottle is poisoned. You have a handful of prisoners about to be executed, and it would mar your celebration to have anyone else killed.

What is the smallest number of prisoners you must have to drink from the bottles to be sure to find the poisoned bottle within 24 hours?

**Solution**

**Solution of King & Wine Bottle Puzzle:**

In the above image, we can explain that,

To test 10 bottles we need only 3 Prisoners because by using 3 prisoners there will be a total of 8 possibilities i.e., 23

So if we go from case to case we can see that:

**Case 1:** If all the 3 prisoners live then all the bottles are safe.

**Case 2:** If only A dies then only bottle 2 is poisoned.

**Case 3:** If only B dies, then bottle 3 is poisoned.

**Case 4:** If only C dies, then bottle 5 is poisoned.

**Case 5:** If both A & B dies, then bottle 4 is poisoned.

**Case 6:** If A & C dies, then bottle 6 is poisoned

**Case 7:** If B & C dies, then bottle 7 is poisoned.

**Case 8:** If all three i.e., A, B, and C dies, then bottle 8 is poisoned.

Hence we can conclude that by using 3 prisoners we can find the defective bottle within 8.

Thus, by using only 10 Prisoners, we can find the poisoned bottle among all the 1000 ones as a possibility after using 10 prisoners will be 210 = 1024, and there are only 1000 bottles.

**Alternate method:**

Number the bottles from 1 to 1000, and write the number in binary format.

**bottle 1** = 0000000001

**bottle 250** = 0011111010

**bottle 1000** = 1111101000

Now take your prisoner’s 1 through 10

and

Let prisoner 1 take a sip from every bottle that has a 1 in its least significant bit.

Let prisoner 10 take a sip from every bottle with a 1 in its most significant bit. etc.

**Prisoner** – 10 9 8 7 6 5 4 3 2 1

**Bottle 924** – 1 1 1 0 0 1 1 1 0 0

In this, bottle #924 would be sipped by 10,9,8,5,4 and 3

That way if bottle #924 was the poisoned one, only those prisoners would die.

After four weeks,

line the prisoners up in their bit order and read each living prisoner as a 0 bit and each dead prisoner as a 1 bit.

The number that you get is the bottle of wine that was poisoned.

**Get over 200+ course One Subscription**

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

**Crossing the Bridge Puzzle Answer****Death & Marbles Puzzle Answer****Airplane Seat Puzzle Answer****2 Eggs & 100 Floors Puzzle Answer****Bank Cashier Puzzle Answer****Calendar Cube Puzzle Answer****Ants & Triangle Puzzle Answer****Measuring 9 mins Puzzle Answer****Bulb in a Circle Puzzle Answer****Camel & Bananas Puzzle Answer****Sum & Product Puzzle Answer****Heaven or Hell Puzzle Answer****3 Mislablled Jars Puzzle Answer**

Login/Signup to comment