Exposure in both directions
transcript
A payments desk watches money. Money in is positive. Money out is negative.
A large net in needs a review. So does a large net out. So keep the size, not the sign.
Five entries, a five second span. The nets are thirty, minus sixty, minus forty. The largest size is sixty.
An entry leaves when it is span seconds old. Subtract its amount from the net. Then move the left end forward.
An entry exactly five seconds old has left. Keep it too long, and the answer is a hundred and ten.
A big net out is a risk. A big net in is also a risk. Both need a review.
In the interview, ask if the window is open. Ask if the span is in seconds. And ask if amounts are signed.
Each entry joins once. Each entry leaves once. So the cost is linear.
Largest absolute net. Leave at span seconds. Full breakdown in the lecture.