# Measuring Mystery

## Classic interview question in the Aha! category

This is another one that Microsoft and other companies have used as an interview question but it’s a little easier than some of my recent brain benders. You have two empty containers – one has a capacity of five liters of water and the other can hold at most three liters of water. Both containers are made of clear plastic and have absolutely no markings anywhere. Here’s your challenge: given an unlimited supply of water, I want you to come up with a way to measure exactly four liters of water. Leave me a comment if you find the answer. Good luck!

Solution: I received nine answers to this week’s puzzle and all of them were correct! I have some very smart friends. :) Before I share the solution, I’d like to recognize a few noteworthy submissions:

Simon Banks and Morag Livingston are living proof that married couples think alike. Muzaffer Peynirci submitted a brilliant algorithm that works independently of which container holds five liters and which holds three. In essence, Muzaffer solved a much harder problem: measure the four liters of water using the two containers while blindfolded! Demonstrating admirable perseverance, Al Pessot submitted one accurate solution and then followed up with an equally correct but more efficient algorithm. Similarly nice work was submitted by Mudassir Ansari and Ricardo Agudo. Katy Gustafson submitted five (5!) different ways to find the answer, including one approach involving boiling water and another involving sound waves! She concedes that one of her solutions may be in error but that still gave her two more correct answers than anyone else, not to mention the Out of the Box Thinking Prize. Well done, all! As noted, there are a few ways to solve this one but here’s a three step approach that I find the simplest:

Let’s call the two containers C5 and C3. Fill up C5 and pour its contents into C3 until the latter is filled to the brim. At this point C5 has two liters and C3 has three liters. Empty C3 and pour the contents of C5 into C3. At this point C5 is empty and C3 has two liters. Fill C5 and pour its contents into C3 until the latter is filled to the brim. You’ve just added one liter to C3 and removed one liter from C5. Therefore, at this point C3 has three liters and C5 has four liters and you’re done.