Find the length-k window with the highest average. No re-summing each window —
build the sum for the first k elements once, then slide: add the new element,
drop the oldest one, compare.
Execution
idle
Press Run to begin.
0 / 0
Speed
Java · running line
in windowjust removednew max
O(n) time · O(1) space · track the max sum, not the max average — divide by k exactly once, at the end.