A value that pairs with itself.
transcript
One payment. A target of ten. The code reports a pair. There is no pair. It happens on tiny lists only. Long tests hide it.
The list holds one value, five. The target is ten. Five needs a partner of five. There is no second payment. So no pair can exist. Five cannot pair with itself.
The buggy code stores five first. Then it looks up five. It finds itself, at position zero. The map held only this one value. It matched the wrong thing. Nothing crashes. The answer is wrong.
Stored first, the answer is a pair. Looked up first, no pair is found. Same code, two lines swapped. Only the order differs.
Swap the two lines. Look the complement up first. Store the value afterwards. A value never pairs with itself. The map holds earlier values only. Then every pair is a real pair.
Test a list of one. Full breakdown in the lecture.