Saturday Puzzle #19 – Measuring Mystery

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:

  1. 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.
  2. Empty C3 and pour the contents of C5 into C3. At this point C5 is empty and C3 has two liters.
  3. 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.

9 thoughts on “Saturday Puzzle #19 – Measuring Mystery”

  1. Fill up the three pour it into the five, refill then add this to the five (This leaves one litre in the three)
    Pour away the contents of the five.
    Transfer the one litre from the three to the now empty five.
    Refill the three and add to the five who’s contents now equal 4 litres.

  2. I’m going for the following (assuming you can discard water if you need to)

    Fill 3 litre container – empty this into 5 litre container. Fill 3 litre container again and add 2 of these litres into 5 litre container. This leaves 1 litre in 3 litre container. Discard the contents of the 5 litre container and then put the 1 litre which is in 3 litre container into it.

    Fill 3 litre container again and add to the 1 litre – giving 4 litres……

  3. - Fill the 5 litres container full
    - From 5 litres cup transfer water to 3 litres cup, so now 2 litres are left in 5 litre cup
    - Empty the 3 litres cup and transfer the remaining 2 litres from 5 lt cup to 3 lt cup
    - Fill the 5 litre cup again from the source, so now there is 5 lts in 5 ltr cup and 2 lts in 3 ltr cup
    - Now fill the 3 ltr cup from 5 ltr cup, so now 3ltr cup has space for 1 ltr more, so now 4 ltr of water is left in 5 ltr cup

  4. Fill the 3.
    Pour it into the 5.
    Fill the 3.
    Pour it into the 5 until the 5 is full, leaving 1 liter in the 3.
    Empty the 5.
    Pour the 1 liter left in the 3 into the 5.
    Fill the 3, pour it into the 5, you now ave 4 liters in the 5

  5. Choose one bottle (either 3 lt or 5 lt. one). Lets call it first bottle and the other one second bottle. Then here is the algorithm;
    0 – empty first and second bottles :)
    1 – Fill first bottle with water.
    2 – Pour first bottle into second bottle until either second bottle is filled or first bottle is empty.
    3 – If second bottle is full then empty it.
    4 – If first bottle is not empty then pour its water into second one.
    3 – If the 5lt bottle doesn’t contain 4lt then “go to” step 1 :)

  6. Fill the big container.
    Pass 3 l. to the small container; 2l. remain in the big container.
    Empty the small container.
    Pass the 2 l. in the big container to the small container.
    Fill the big container.
    Pass water from the big container to the small until the latter is full (i.e.: pass 1 l. out of 5).
    4 l. of water remain in the big container.

  7. Clearly this puzzle has many solutions, maybe the goal should be to do it in the minimum number of steps. My previous answer had 8 steps, can I do better? Maybe.
    Fill 5 liter bucket.
    Transfer 3 liters into the 3 liter bucket leaving 2 liters in the 5.
    Empty the 3 liter.
    Pour the 2 liters from the 5 to the 3.
    Fill the 5,
    Pour 1 liter from the 5 to fill the 3 leaving 4 liters in the 5.

  8. I have a few ways to come up with 4 liters of water:

    1) Start with both containers empty. Fill the 3L container 3 to capacity, pour it into 5L container. Fill the 3L container 3 to the top again and pour it into 5L container until 5L container reaches capacity (in other words, add 2 more liters of water). There will now be 1L of water remaining in the 3L container. Dump contents of 5L container, and pour the 1L from the 3L container into the 5L container. Refill the 3L container completely, then add those 3L to the 1L that is in the 5L container. You now have 4L of water.

    2) Start with both containers empty. Fill the 5L container to capacity, and transfer 3L of its water into the 3L container. You now have 2L in the 5L container. Empty the 3L container and transfer the 2L into the 3L container. Refill the 5L container to capacity, then pour 1L from the 5L container into the 3L container. You will know you’ve poured off 1 liter when the 3L container is filled to capacity (since there was room for exactly one more liter in this container) You now have 4L in the 5L container.

    3) This is similar to #2 but with a twist. Since dimensions were not specified, we will assume that the 2 containers if different capacities (3L & 5L) are otherwise identical cylindrical containers with the same diameter. Start with both containers empty. Fill the 5L container to capacity. Transfer 3 of the 5 liters to the 3L container. You now have 2L in the 5L container. Set the 3L container right next to the 5L container. Fill the 3L container to the point where its water line is exactly level with that of the 5L container. Now both containers should have 2 liters in them. You now have 4 liters.

    4) OK, this one is a stretch and may defy some laws of physics, but if your life depended on coming up with 4L, it would be worth a try! Fill the 5L container to capacity and place the 3L on top of the 5L container to act as a lid on the 5L container. Heat the 5L container with a uniform heat source until the water starts to boil. Remove 3L container (lid) and start counting (or use stopwatch). Stop timing when water in the 5L container has evaporated and the container is completely empty. Record amount of time it took for all 5L of water to evaporate. Refill 5L container, place the 3L on top of the 5L container as before. Heat the 5L container with uniform heat source until the water starts to boil. Remove 3L container (lid) and start timer but this time, at exactly 1/5 of the time it took to for all water to evaporate from the 5L container during first boiling, cover the top of the 5L container with the 3 liter container while simultaneously removing the 5L container from the heat source. At this point, 1 of the 5L should have evaporated from the 5L container, leaving you with 4L of water.

    5) In this case both containers are made of glass. Start with 2 empty containers. Fill the 3L to capacity. Transfer these 3 liters into 5L container. Strike 5L container with a mallet and measure & record the exact frequency of the audible tone with your frequency measuring device (assuming you have one!) Now fill the 5L container to capacity and again strike container with a mallet and again record the frequency of the audible tone with your frequency measuring device. Add the 2 recorded frequencies, divide by 2 and note their their mean average. Empty the 5L container little by little, striking it every so often with a mallet and noting its frequency until you reach the frequency (number) that exactly equals the mean average frequency (number) of the 2 initial frequencies. I think you will now have 4 liters of water.

  9. I must completely scratch #5, submitted earlier. First, because you already stated that the containers are plastic, 2nd because I’m cheating by having a measuring device and 3rd because I just consulted my student (son) who told me that determining the mean frequency of 2 sound frequencies using the simple mean average formula is “unsound” since sound frequency is exponential not linear. Maybe there’s another way using sound but I can’t think of it!

Leave a Reply