Jump to content

Problem Question 1 HELP PLZ


nadeemshafi9

Recommended Posts

Hello Guys

 

A question was put forward to me by an interviewer and i was quit baffled.

 

If you have a container that can hold 4 litre and one that can hold 9 litre, how do you get 6 litre's exact. You are not allowed to hold any units outside the two containers. I have solved parts of the problem.

 

Thanks for any help

Link to comment
https://forums.phpfreaks.com/topic/55640-problem-question-1-help-plz/
Share on other sites

Fill the 9, pour to the 4 until top. Now you have 5 in the 9 and 4 in the 4. Empty the 4, and pour from the 9 to the 4 until top. Now you have 1 in the 9 and 4 in the 4. Empty the four and pour the 1 liter that is in the 9 to the 4. Now you have 0 in 9 and 1 in 4. Now fill the 9 and pour into the 4 until it fills and walla- you have 6 in the 9.

 

Orio.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.