Practice · 5 of 5
Fixed Window Maximum Sum
CHALLENGE
Difficulty: intermediate+25 XP
**Description:** Print the maximum sum of any k consecutive elements.
**Input:** Line 1: n k (1 <= k <= n <= 200000). Line 2: n integers
(|a[i]| <= 10^9).
**Output:** One integer — the maximum window sum.
**Example:** 6 3 / 2 1 5 1 3 2 -> 9 (5+1+3).
Press Submit to check your solution.
Back to lesson: Practice: Two Pointers Problem Set