Suppose you have an unmarked 3-gallon and an unmarked 5-gallon bottle that you can fill from a fountain of water.
How to fill the 5-gallon bottle with exactly 4 gallons of water?
To conserve the water, what is the minimum amount of water in gallons required to accomplish this challenge?
Explanations
Step 1. Fill the 5-gal bottle.
Step 2. Pour the 5-gal bottle into the 3-gal bottle. (Leaves you with 2 gallons in the 5-gal bottle).
Step 3. Empty the 3-gal bottle.
Step 4. Pour the remaining 2 gallons from the 5-gal bottle into the 3-gal bottle.
Step 5. Fill the 5-gal bottle again and pour 1 gallon into the 3-gal bottle.
Step 6. The 5-gal bottle now holds exactly 4 gallons of water.
The aforementioned steps are shown in the diagram.
In total 10 gallons are needed to accomplish this challenge - filling up the 5-gal bottle twice at steps 1 and 5 respectively.