Three units in stock. Alice and Bob each buy two at once.

Answer it out loud before you open anything. The value of the flags below is in comparing them to what you actually said — including whether you asked who uses it before naming what you would build it with.

The situation behind the question

You are asked to explain, on a whiteboard, what should happen and what will happen in the online store when two customers buy more than the remaining stock at the same moment. The current code reads stock, checks it, and writes stock minus quantity.

What it is really testing

Whether the candidate can construct a concrete example and run it by hand to find the bug, then generalise to edge cases and counterexamples, rather than reasoning in the abstract about "concurrency issues".

Where the move is taught