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:
Alternative...
0 5 0
0 2 3
2 0 0
2 5 0
2 2 3
4 0 0
you are assuming that there is unlimited source of water. But question explicitly mentions that you cant use external water source.
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...
Thanks for writing this.
Post a Comment