Secure document transmission with padlocks

Sending a document securely with padlocks is an easy quant interview question on Brain Teasers.

Difficulty Easy Topic Brain Teasers

This brain teaser describes a secure communication problem using physical padlocks and a courier that cannot be trusted. The candidate is asked to reason about how two parties, each with their own keys and no prior key exchange, can still arrange for a secret object to be transported without exposing it to interception. The twist is that all security must be achieved through the constraints of the locking mechanism and the rules about when contents are lost, forcing you to think about sequences of actions rather than any cryptographic protocol or digital trick.

The puzzle leans on systematic state reasoning and careful tracking of who can open what at each step. It tests the ability to model constraints, explore possible sequences of operations, and identify a strategy that works under worst-case interference by the messenger. Interviewers watch for clear enumeration of states, explicit consideration of what each party knows and can do, and the ability to discard naive but insecure ideas. Strong answers show comfort translating an everyday scenario into a simple but rigorous protocol.

What it tests

Problems of this class are governed by invariants: quantities or properties that remain unchanged (or change in a predictable way) throughout a process, despite the system's apparent complexity. In particular, tracking the parity (odd or even nature) of a key variable often reveals a hidden structure that constrains the possible outcomes. The reason this works is that each operation, no matter how complicated, can be analyzed for its effect on the invariant, and if the invariant restricts the final state to a single possibility, the answer becomes clear. In ball-removal or transformation problems, the color counts may fluctuate, but the parity of one color (or a related function) often acts as a fingerprint for the system's evolution. This principle holds because the allowed operations interact with the invariant in a way that is independent of the specific sequence of steps.

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

Get started free