# Puzzle | David and Goliath

David and Goliath live on an island Geeksland. One day they both start fighting over an algorithm and realize both of them cannot live together. They want to kill each other. Geeksland has seven poisoned wells, numbered from 1 to 7. If you drink from a well, you can only save yourself by drinking from a higher numbered well.

**For example:**

If you drink water from well number 3 and follow it up by drinking water from any one of wells 4,5,6 or 7, it acts as anti-venom and you are saved.

Well 7 is located at the top of Geeks mountain. Only Goliath is able to reach well number 7. This means David can access wells 1-6 and Goliath has access to wells 1-7.

They decide that to resolve this issue each of them will bring a glass of water. They will exchange their glasses and drink the water. After the duel, David lives and Goliath dies.

What strategy did David use to survive?

**HINT:** Think not only outside the box but outside the island.

**Solution:** Goliath knew that David cannot reach well number 7. So he would get water from well 6 or 7 for David. As a result, he thinks David would die.

David knew that no matter from which well he gives the water, Goliath will go and drink water from well 7 and live.

The problem statement clearly mentions that both of them live on an island.

So, David got sea water for Goliath and before duel drank water from well number 1. When they exchanged glasses and drank water, Goliath rushed to well 7 and drank poison from it, thinking that it would cure the poison he just drank (but he drank sea water), so Goliath died.

David on the other hand already had poison from well 1 so what Goliath gave him effectively cured him. So he lived.

This article is contributed by **Ankit Jain**. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

## Recommended Posts:

- Puzzle 1 | (How to Measure 45 minutes using two identical wires?)
- Puzzle 2 | (Find ages of daughters)
- Puzzle 3 | (Calculate total distance travelled by bee)
- Puzzle 4 | (Pay an employee using a 7 units gold rod?)
- Puzzle 13 | (100 Prisoners with Red/Black Hats)
- Puzzle 5 | (Finding the poisoned wine)
- Puzzle 6 | (Monty Hall problem)
- Puzzle 7 | (3 Bulbs and 3 Switches)
- Puzzle 8 | (Find the Jar with contaminated pills)
- Puzzle 9 | (Find the fastest 3 horses)
- Puzzle 10 | (A Man with Medical Condition and 2 Pills)
- Puzzle 11 | (1000 Coins and 10 Bags)
- Puzzle 12 | (Maximize probability of White Ball)
- Puzzle 14 | (Strategy for a 2 Player Coin Game)
- Puzzle 15 | (Camel and Banana Puzzle)