#21 - Gallon Riddle

There are three gallons X,Y & Z.

Gallon X having capacity of eight liters is with filled with 5 liters of liquid.
Gallon Y having capacity of five liters is with filled with 3 liters of liquid.
Gallon Z having capacity of three liters is with filled with 2 liters of liquid.

How can you measure 1 liter of liquid in minimum number of steps ?

Gallon Riddle

Step 1) Pour 1 litre of liquid from gallon X to gallon Z. Now 4 litres of liquid is left in the gallon X and gallon Z is full.

Step 2) Pour liquid from gallon Z to gallon Y. Now as soon as gallon Y is full , you know there is one liter of liquid is in gallon Z.

#22 - Athenahealth Interview Puzzle

You enter a logical virtual tournament. The first problem that is in front of you is as follows:
You have a three liters and a 5 liters measuring jars. There is a huge tank of water behind you comprising of about 100 liters of water. You have to use only these two jars and take out exactly 4 liters of water. How will you do it ?

Athenahealth Interview Puzzle

Let us name the 5 liters and 3 liters jars as A and B respectively.
First fill A completely.
Now fill B with it completely. Now B has 3 liters of water. Pour it out completely. Now fill the remaining 2 liters of water from A to B. Now B has 2 liters of water while A is empty.
Next, Fill A again fully. Now, fill B with it (which had just 1 liters of capacity remaining). Thus now, A has exactly 4 liters of water.