Measuring two pints

You have a 77-pint and an 1111-pint vessel and an unlimited water source. You must end with exactly 22 pints in a vessel. A single "transaction" is filling a vessel to the top, emptying a vessel completely, or pouring one vessel into the other until the source is empty or the destination is full. What is the minimum number of transactions needed?

Show hints (2)+
  1. Model states (a,b)(a,b) and do a breadth-first search; each fill/empty/pour is one transaction.
  2. The shortest path to a vessel holding 22 takes 1414 moves.

Answer

Reveal answer →

14

Want the full step-by-step worked solution? It's part of Premium - along with a worked solution for every question in the bank.

Asked at: Jane Street, Optiver

Related questions