Dsa
Sliding Window
Easy
Maximize Sliding Window Sum
You are given an array of integers and a window size. Your task is to find the maximum sum of any contiguous subarray of that window size. Input the size of the array followed by the elements of the array and the window size in one line (e.g., '5 2 1 3 2 5 4'). Output the maximum sum found.
Example:
Input:
5 2 1 3 2 5 4
Output:
8
Key concepts
sliding_windowarraysum
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now