Monday, January 07, 2008

Measure 4 Ltr using 8 5 3 ltr cans

Question:
You have three cans of capacity 8, 5, 3 ltrs. 8 ltr can is filled with 8 ltrs of water, 5 and 3 ltr cans are empty. How do u measure 4 ltrs without throwing away water and without adding any.

Solution:
8 5 3 Cans
==================
8 0 0 Initial State
3 5 0
3 2 3
6 2 0
6 0 2
1 5 2
1 4 3

4 comments:

  1. Alternative...
    0 5 0
    0 2 3
    2 0 0
    2 5 0
    2 2 3
    4 0 0

    ReplyDelete
  2. you are assuming that there is unlimited source of water. But question explicitly mentions that you cant use external water source.

    ReplyDelete
  3. There is a general condition for it, let's try to find it out...

    Question: What is teh necessary condition to determine, if a solution exists or not?

    Answer: Awaited...

    ReplyDelete
  4. Thanks for writing this.

    ReplyDelete