Google Interview Question: How do you make 4 gallons fro... | Glassdoor

# How do you make 4 gallons from a 3 and 5 gallon jug?

7

Fill the 3 gallon jug, pour it into the 5 gallon jug, fill the 3 gallon jug again, fill the 5 gallon jug until it is full (leaving 1 gallon left in the 3 gallon jug) dump out the 5 gallon jug, then pour your remaining 1 gallon into the 5 gallon jug, then fill the 3 gallon jug and add it to the 1 gallon in the 5 gallon jug.

Anonymous on Jun 1, 2011
1

I have another method of getting 4 gallon.
1) Fill 5 gallan jug
2) Pour from 5 gal jug to 3 gal jug till 3 gal jug is full
3) Empty 3 gal Jug
4) Pour from 5 gal jug to 3 gal jug
5) Fill 5 gal jug
6) Pour from 5 gal jug to 3 gal jug till 3 gal jug is full.

Method Statistics:
==================
Total liquid usage : 10 gallons
Total liquid wastage : 3 gallons (reusable?)
Total steps required : 6

Prasad JVV on Jun 15, 2011
1

Updated one from previous.
1) Fill 5 gallon jug
2) Pour from 5 gal jug to 3 gal jug till 3 gal jug is full
3) Empty 3 gal Jug
4) Pour from 5 gal jug to 3 gal jug
5) Fill 5 gal jug
6) Pour from 5 gal jug to 3 gal jug till 3 gal jug is full.

Method Statistics:
==================
Total liquid usage : 10 gallons
Total liquid wastage : 3 gallons (reusable?) + 3 gallons remained in 3 gal jug
Total steps required : 6 + 1 (to empty 3 gal jug?)

Anonymous on Jun 15, 2011
3

1. Fill the 5 gallon jug.
2. Pour the 5 gallon jug into the 3 gallon jug. (Leaves you with 2 gallons in 5 gallon jug)
3. Empty the 3 gallon jug and pour the remaining 2 gallons in the 3 gallon jug.
4. Fill the 5 gallon jug and pour 1 gallon into the 3 gallon jug (remember it will only take one gallon)
5. Viola the remaining 5 gallon jug will have exactly 4 gallons remaining.

D.G. Fox on Sep 29, 2011
13

Fill up each jug half way. 2.5+1.5=4

J Cloud on Oct 19, 2011