The Water Jug Challenge Puzzle : Solution
What was the puzzle?
We've got a 4 liter jug and a 9 liter jug.
We've got a pool of water.
We have to find fewest number of steps it takes to come up with exactly 6 liters of water.
STEPS :
1. Fill up the 9 liter jug from the pool. 9L - 9 4L - 0
2. Fill up the 4 liter jug from the 9 liter jug. 9L - 5 4L - 4
3. Empty the 4 liter jug into the pool. 9L - 5 4L - 0
4. Fill 4 liter jug again from the 9 liter jug. 9L - 1 4L - 4
5. Empty the 4 liter jug into the pool 9L - 1 4L - 0
6. Transfer 1 liter left 9L jug into the 4L. 9L - 0 4L - 1
7. Fill the 9 liter jug from the pool. 9L - 9 4L - 1
8. Fill up the 4 liter jug from the 9 liter jug. 9L - 6 4L - 4
That's how we have exactly 6 liters of water in 9 liters jug.
Comments
Post a Comment