Sliding windowIntro

The Programming Masterclass · Act 1

“Best three-over spell of the innings?”

Last over of a T20. The commentator turns to you, the scorer: “Which three consecutive overs scored the most?” Your book has runs per over: 12, 4, 18, 9, 3, 14... twenty numbers, and he needs the answer before the ad break ends.

Eighteen possible three-over stretches. Do you add up all three numbers, eighteen separate times?

Quick, honest: how does this feel right now?