Qm
BrainteasersJane Street

Empty one of three buckets by doubling pours

Three buckets contain whole numbers of litres, say a, b and c, all positive, with plenty of spare capacity. The only allowed move is a doubling pour: choose two buckets X and Y and pour from X into Y exactly as much as Y currently holds, so Y doubles and X loses that amount (X must contain at least that much).

Prove that, whatever the starting amounts, a sequence of doubling pours can always empty one of the buckets.

Show a hint

Order the buckets so that a is the smallest. Write b = qa + r with r less than a. Use the binary digits of q to decide, at each doubling of the smallest bucket, whether to pour from the second bucket or the third. Show the smallest amount strictly decreases.

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

  1. No full solutions here. Hints and approaches only.
  2. Complexity, edge cases and intuition are the point.
  3. Interview experiences are welcome. Respect your NDAs.

Loading discussion…

Learn the concepts

The theory behind this question.

Related questions

The 100 lockers problemThe 24-stone game where taking the last stone losesAnts falling off a rodTiling a hexagon with lozengesChameleons changing colors
All questions →