04 Try it yourself Interactive

Watch the total get repaired instead of rebuilt

Same list, same k, two versions. Switch tabs and keep one eye on the operations counter. The amber band is the current window, the amber bar is the element being added, and a rose bar just outside the band is the element that has left. Next moves one step; nothing runs on its own.

Recompute every window
recompute · O(n · k) · k = 3
2–9 whole numbers (0–99), commas or spaces.
Press Next to begin. Each press moves one step.


      
Window
Window sum
Best sum0
Operations0
step 0 / 0