Fill the 5 liter jug. Then fill the 3 liter jug to the top
with water from the 5 liter jug. Now you have 2 liters of water in the 5
liter jug. Dump out the 3 liter jug and pour what's in the 5 liter jug
into the 3 liter jug. Then refill the 5 liter jug, and fill up the 3 liter
jug to the top. Since there were already 2 liters of water in the 3 liter
jug, 1 liter is removed from the 5 liter jug, leaving 4 liters of water
in the 5 liter jug.
Solution 2:
Fill the 3 liter jug and pour it into the 5 liter jug. Then
refill the 3 liter jug and fill up the 5 liter jug to the top. Since there
were already 3 liters of water in the 5 liter jug, 2 liters of water are
removed from the 3 liter jug, leaving 1 liter of water in the 3 liter jug.
Then dump out the 5 liter jug and pour what's in the 3 liter jug into the
5 liter jug. Refill the 3 liter jug and pour it into the 5 liter jug. Now
you have 4 liters of water in the 5 liter jug.