Given an array of integers arr and an integer k, find the maximum sum of a subarray of size k.
Input:
n.n space-separated integers representing the array arr.k.Output:
k.Example:
5
1 2 3 4 5
312Example 1
Input: 5 1 2 3 4 5 3
Output: 12
The subarray [3, 4, 5] has the maximum sum of 12.
Constraints
Hints
Given an array of integers arr and an integer k, find the maximum sum of a subarray of size k.
Input:
n.n space-separated integers representing the array arr.k.Output:
k.Example:
5
1 2 3 4 5
312Example 1
Input: 5 1 2 3 4 5 3
Output: 12
The subarray [3, 4, 5] has the maximum sum of 12.
Constraints
Hints