Citrix System Inc Interview Question
Quality Assurance EngineersTeam: Xen-Client
Country: India
Interview Type: In-Person
@abh007
nop, thats not the only answer.. even though following has more steps, it does achieve the goal..
1> fill up 3 ltr jug -> pour it into 5 ltr jug
2> fill up 3 ltr jug -> pour as much as possible in 5 ltr jug
3> empty 5 ltr jug
4> pour 1 ltr remaining liquid from 3 ltr jug into 5 ltr jug
5> fill up 3 ltr jug again and pour it into 5 ltr jug.. now 5 ltr jug has 4 ltr liquid in it
1) fill the 2
2) 2 -> 5
3) repeat step 1 and 2
You will have 4 in 5. So, what is the point of this interview question?
i like the last line of the last answer and wonder why question and its original complicated answer
1. fill just a half of each jugs
3->1.5;
5->2.5)
2. pour jug 3 into jug 5, you will have 1.5+2.5=4
fill 5 ltr jar and pour it in 3 ltr, so 2 ltr remains in 5 ltr jar.
- mp April 05, 2012Empty 3 ltr jar and pour 2 ltr from 5 ltr jar into it.
Now fill 5 ltr jar again and use it to fill remaining 1 ltr in 3 ltr jar. that keeps 4 ltr in 5 ltr jar