Quart in Two Pours

Measuring one quart using two vessels is a medium quant interview question on Brain Teasers, reported to have been seen at Optiver.

Difficulty Medium Topic Brain Teasers Reported at Optiver

MyQuantPartner is not affiliated with, endorsed by, or sponsored by these companies, and all trademarks belong to their respective owners.

This brain teaser belongs to the classic water jug family, a staple in quant interviews and brainteaser-heavy quant prep. It frames a simple, everyday setting around a hidden discrete state-space problem, forcing you to think in terms of configurations rather than continuous amounts. The unlimited barrel acts like a reservoir that expands the search space while still keeping the puzzle finite and structured.

Solving this trains your ability to reason about invariants, attainable states, and the role of number-theoretic structure in combinatorial setups. It builds intuition about gcd-based feasibility, efficient search over configurations, and careful accounting of operations, all under a "minimum steps" constraint that pushes you toward optimization thinking.

This matters in quant interviews because it mirrors how you tackle trading and risk problems: formalize an abstract state space, understand constraints, check feasibility, and then optimize under discrete operations and costs.

What it tests

This class of problems is governed by the principles of the water jug (or vessel) problem, which is fundamentally about using the greatest common divisor (gcd) of vessel sizes to measure out specific quantities. The key insight is that with two vessels of sizes `a` and `b`, you can measure any integer amount that is a multiple of gcd(a, b), using only the operations of filling, emptying, and transferring between vessels. The presence of an unlimited reservoir (the barrel) allows you to reset or store partial quantities, enabling more flexible manipulation. The structure of these problems is about systematically exploring the state space of possible vessel contents, using the allowed operations to reach the target configuration.

Practise this question with written feedback, or hear it in a spoken mock interview.

Get started free