There are two bottles of 10litre each filled with water.
Now two persons having empty bottles of 4litre and 5litre want to take 2litres of water each from the previous 10litre bottles..
Now you have to pour the water without wasting or throwing it.
This is an question in a previous placement paper. I was not getting how to proceed. Can anyone give me some hint....
Call containers by $A=10,B=10,C=5,D=4$.
Start by pouring $A$ into $C$, then $B$ into $D$. Pour $D$ into $A$, then $C$ into $B$, then $C$ into $D$. Now you have $1$ in $D$. Pour from $A$ into $C$, then from $C$ into $D$, leaving $2$ in $C$. Now pour from $D$ into $A$, then $B$ into $D$, then $D$ into $A$ again, leaving $2$ in $D$.
Alternate recipe (among many), uses "front loading":
Pour $A$ into $D$, $D$ into $C$, $A$ into $D$, $D$ into $C$, $C$ into $A$, $D$ into $C$, $B$ into $C$, $C$ into $A$ (note $C$ contains $2$), $A$ into $D$, and $D$ into $B$ and done.
The strategy in the first example was a sort of guess and check. In the second example, I focused on building appropriately-sized "holes" in the larger containers, which made it very easy.