Maximum Window Sum

Medium · rating 1300 · Sliding Window, Arrays

The first line contains n and k. The second line has n integers. Print the maximum sum of any contiguous block of exactly k elements.

Constraints: 1 ≤ k ≤ n ≤ 105

Related problems

Open Maximum Window Sum in Code Arena →