Exactly one litre from a 7 and a 5
You have two jugs with no markings: one holds exactly 7 litres, the other exactly 5 litres. There is a tap with unlimited water and a drain. A "move" is one of: fill a jug to the top, empty a jug completely, or pour from one jug into the other until the source is empty or the target is full.
Measure out exactly 1 litre. Then find the smallest number of moves in which it can be done.
Show a hint
Keep filling the small jug and tipping it into the big one. Every time the big jug overflows, something useful is left behind in the small one.
Your answer
Solving needs a free account
Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.
Discussion
Sign in to join the discussion · reading is open to everyone
💡 Discussion rules
- No full solutions here. Hints and approaches only.
- Complexity, edge cases and intuition are the point.
- Interview experiences are welcome. Respect your NDAs.
Loading discussion…
Learn the concepts
The theory behind this question.
Related questions
Three litres from a 12 and a 5Measure 8 litres with a 10 and a 6Split eight litres in half with a 5 and a 3Fill a tank to exactly 17 litres with two jugsMeasure exactly 6 litres with a 9 and a 4 jugSplit 10 litres of cider into two equal shares
All questions →