Measure Milk by Cans

There is a drum full of milk.
People come for buying milk in the range of 1-40 litres.
You can have only 4 cans to draw milk out of drum. Tell me what should be the measurement of these four cans so that you can measure any amount of milk in the range of 1-40 litres.

Note that the cans cannot be used more than once.

Output the numbers in ascending order space separated.

Hints
  • Complete Solution
1817 successful submissions.
Asked In:
  • Amtel
Click here to jump start your coding interview preparation