120-Quart Puzzle Solved in 2 Moves
Measuring One Quart with Two Containers is a medium quant interview question on Brain Teasers, reported to have been seen at Optiver.
MyQuantPartner is not affiliated with, endorsed by, or sponsored by these companies, and all trademarks belong to their respective owners.
This classic brain teaser falls into the family of measuring and pouring puzzles that show up frequently in quant interviews and quant prep material. It replaces abstract equations with a concrete, almost playful setup, but it is fundamentally a number theory and state-space problem dressed up as a story. The presence of multiple containers and a large reservoir makes it richer than the standard two-jug puzzle.
It trains your ability to reason about reachable states under simple operations, connect a concrete puzzle to an underlying algebraic structure, and mentally optimize over discrete sequences of actions. You practice recognizing hidden invariants, thinking in terms of divisibility, and keeping track of several evolving quantities without losing the global objective.
This matters for quant interviews because it mirrors how traders and quantitative researchers must compress messy practical setups into clean mathematical cores. Top trading firms use such questions to see if you quickly detect structure, avoid brute force, and move from an intuitive model of a process to a rigorously justified conclusion under time pressure.
What it tests
This problem class is governed by the principle that the set of measurable quantities using two containers of sizes `a` and `b` consists of all integer multiples of their greatest common divisor (GCD). The Euclidean algorithm not only determines whether a target volume is possible (if and only if the target is a multiple of the GCD), but also provides a constructive sequence of steps to achieve it. Each pour or transfer corresponds to a step in the algorithm, systematically reducing the difference between the current and target volumes. The minimality of steps often relies on efficiently using the containers' capacities and the structure of the algorithm, rather than brute-force enumeration. The underlying reason this works is that pouring between containers is equivalent to subtracting or adding their sizes, mirroring the GCD process, which iteratively reduces numbers by their differences.
Practise this question with written feedback, or hear it in a spoken mock interview.
Get started free