Problems > Best Window of Size K > Editorial

Best Window of Size K — Solution & Editorial

Back to the Problem

Compute the first window's sum, then slide: add the entering element, subtract the leaving one.

Complexity: O(N)