Suppose you have a 3 liter jar and a 5 liter jar. The jars have no measurement lines on them either. How could you measure exactly 4 liters using only those jars and as much extra water as you need?
This puzzle is asked in many interviews.
The answer is here:
Step 1: First, fill the 5 liter jar and then pour it into the 3 liter jar. Now the 5 liter jar has only 2 liters left.
Step 2: Next, empty out the 3 liter jar. Then, pour the 2 liters from the 5 liter jar to the 3 liter jar. So, now the 3 liter jar has 2 liters.
Step 3: Fill the 5 liter jar again, and pour 1 liter into the 3 liter jar. Now, how much is left in the 5 liter jar? Well, it’s exactly 4 liters! And there’s your answer.