A milkman has two empty jugs: a three gallon jug and a five gallon jug. How can he measure exactly one gallon without wasting any milk?
The Solution
Fill the three gallon jug. Empty it into the five gallon jug. Fill the three gallon jug again. Fill the five gallon jug from the three. You’re left with one gallon of milk in the three gallon jug and five gallons in the five gallon jug.
I've got a masters degree in computer science and over 10 years of experience building web-based systems using Java/J2EE, Ruby, Rails and PHP. I'm a strong believer in the effectiveness of Agile Methods. Read more »
One From Five and Three
The Problem
A milkman has two empty jugs: a three gallon jug and a five gallon jug. How can he measure exactly one gallon without wasting any milk?
The Solution
Fill the three gallon jug. Empty it into the five gallon jug. Fill the three gallon jug again. Fill the five gallon jug from the three. You’re left with one gallon of milk in the three gallon jug and five gallons in the five gallon jug.