Maximum Sum of Subarray of Size K
Input: Array: [2, 2, 1, 5, 3, 0], Window size (K): 3
Goal: Find the maximum sum of any subarray that contains exactly 3 consecutive elements.
Index 0 to 2
[2, 2, 1]
2 + 2 + 1 = 5
Initialize the first window of size 3
The maximum sum of any subarray of size 3 is: 9
Found in window [1, 5, 3] at indices 2-4