Fog Creek Software
Discussion Board




Two Buckets

You have two buckets. One has a capacity of 3 gallons, and the other has a capacity of 4 gallons. Your task is to use these two buckets to get 2 gallons of water. How do you do this?

Stefaan R. M. Meeuws
Friday, November 28, 2003

Fill the 3 gallon up and pour it into the 4gallon one.
Fill the 3 gallon up again and top up the 4 gallon with the water from the 3 gallon bucket.

You are left with 2 gallons in 3 gallon bucket.

msafar
Friday, November 28, 2003

That was mighty quick, msafar.

My solution was much lengthier:

Fill the 4 gallon bucket.
Pour it in the 3 gallon bucket.
You are left with 1 gallon in the 4 gallon bucket.
Empty the 3 gallon bucket.
Pour the 1 gallon from the 4 gallon bucket in the 3 gallon bucket. 2 more gallons can be added to the 3 gallon bucket before it's full.
Fill the 4 gallon bucket.
Fill up the 3 gallon bucket with the 4 gallon bucket. You will be able to add 2 gallons to the 3 gallon bucket, so you are left with 2 gallons in the 4 gallon bucket.

Stefaan R. M. Meeuws
Sunday, November 30, 2003

Look at it this way, you have 3 and 4 and need to come up with a 2 using simple mathematic operations (addition and subtraction) in the most straightforward way.

In msafar’s method, it boils down to 3 + 3 – 4 = 2.  He or she used 6 gallons of water and dumped 4 gallons of water.

In Meeuws’ method, it is 4 + 4 – 3 – 3 = 2.  He or she used 8 gallons of water and dumped 6 gallons of water.

Of course you can throw in multiplication and say it is 3 * 2 – 4 = 2 or 4 * 2 – 3 * 2 = 2, but multiplication is just another way of writing addition.

If I remember correctly, the movie “True Lies” (1994) staring current California governor Arnold Schwarzenegger has a scene with a similar puzzle.  How to make 4 gallons of water with a 3-gallon bucket and a 5-gallon bucket?

Solution 1
5 + 5 – 3 – 3 = 4
Fill the 5, pour into 3 and dump the 3.
Pour the remaining 2 in 5 to 3.
Fill the 5 again, pour into 3, now you have 4 in 5, done.

Solution 2
3 + 3 + 3 – 5 = 4
Fill the 3, pour into 5.
Fill the 3 again, pour into 5 and dump 5.
Pour the remaining 1 in 3 to 5.
Fill the 3 again, pour into 5, now you have 4 in 5, done.

Do not remember which solution was presented in the movie though.

JHY
Monday, December 01, 2003

It was "Die Hard with a vengeance" dude not True Lies

Gabriel
Tuesday, January 13, 2004

Sorry about the misinformation.  I got confused.

JHY
Tuesday, January 13, 2004

i just watched the die hard with a vegence movie

:) and i missed the solution
so i had to look it up haha

kromped
Saturday, February 07, 2004

Funny... I'm here because of Die Hard With a Vengeance also. The dude that posted before me must've seen the EST feed. :)

Daniel Buki
Sunday, February 08, 2004

Good Discussion about the problem,...I found the site just now.

PradeepKumarReddy
Tuesday, February 17, 2004

yea i just watched the movie and im like im not gonna die cuz i dont know this HAHA

YEa
Wednesday, March 03, 2004

*  Recent Topics

*  Fog Creek Home