GFG App
Open App
Browser
Continue

# Puzzle 54 | Fill the Jug

There are two jugs each of 4 and 3 liters respectively , without any measuring marks. how many minimum steps are required to have 2 liters of water into the 4 litre jug (the jugs can be filled any number of times with water, and they can be emptied any number of times).

Note that this puzzle is different from the one discussed here. Here we need 2 litre water in 4 litre jug (not in any of the two jugs).

Explanation:

Thinking Recursively:
As we want 2litre water in a 4liter mug, this can be achieved by the following last states:
1. Having 1litre in a 3litre mug
2. Having 2litre in 4litre mug

1. First one as easy to think as the difference between the mugs (4-3 =1)

Step 1 : Fill 4-litre jug with water completely
Step 2 : Empty water from 4-litre jug into 3-litre  (leaving 1L in 4litre mug and 3L in 3 litre mug)
Step 3 : Empty water from 3-litre
Step 4 : pour water from 4-litre jug into 3-litre jug (leaving 0L in 4litre mug and 1L in 3 litre mug)
Step 5 : Fill 4-litre jug with water completely again.
Step 6: Transfer water of 4-litre jug to 3-litre jug, resulting in 2 litre water in 4-litre jug.

2. Second approach:
Step 1 : Fill 3-litre jug with water completely
Step 2 : Empty water from 3-litre jug into 4-litre
Step 3 : Again, fill 3-litre jug with water completely
Step 4 : And pour water from 3-litre jug into 4-litre jug until 4-litre jug becomes full
Step 5 : Empty the 4-litre jug. Now, we are left with 2 litre water in 3-litre jug and 4-litre jug is empty.
Step 6: Transfer water of 3-litre jug to 4-litre jug, resulting in 2 litre water in 4-litre jug.