This, or a close variant, is the question that separates candidates most reliably, because it is answered by method rather than recall.
function withdraw(uint256 amount) external {
require(balances[msg.sender] >= amount);
payable(msg.sender).call{value: amount}("");
balances[msg.sender] -= amount;
}
A strong answer walks a fixed order. Authorisation: who may call this, and is msg.sender the right identity. State ordering: the balance is decremented after control has left, so a re-entrant call sees the old balance and drains the contract. Return values: the low-level call's result is discarded, so a failed send still decrements — or in this ordering, still returns as though it paid out. Arithmetic and bounds: the decrement is fine under checked arithmetic, but the require carries no message, which makes failures unreadable. External interactions: the recipient is arbitrary code, so gas and callbacks are its choice, not yours.
Then it proposes the fix and its invariant: move the decrement above the call, propagate the failure with a require on the result, add a non-re-entrant guard as a backstop, and state the property being preserved — accounting is consistent at every point where control can leave.
A weak answer identifies re-entrancy, names a guard modifier, and stops. It is not wrong, and it misses the discarded return value entirely, which is the second bug in three lines. What the interviewer is grading is whether you have a checklist you apply to unfamiliar code, because that is what reviewing a colleague's contract will require of you every week.