A partner that is itself
transcript
Two delivery windows must fill a shift. The shift is ten minutes. One window lasts five minutes. Does it have a partner?
The partner value is ten minus five. That is five again. A set says five is there.
But a pair needs two windows. This window found itself. The right answer is zero.
Count the durations instead of storing a set. Is the partner equal to x? Then ask for two copies. Otherwise, one copy of the partner is enough.
Durations five and one. Shift ten. The set code counts the five. Counts say five appears once. So the answer is zero.
The same trap waits in other problems. Pairs a gap of zero apart pair a value with itself. They need two copies too. Test that case first.
A set says what exists. Counts say how many. When the partner is x, ask for two. Full breakdown in the lecture.