#K1776. Maximum Sum Subarray of Fixed Length
Maximum Sum Subarray of Fixed Length
Maximum Sum Subarray of Fixed Length
You are given an integer n, a positive integer k, and an array of n integers. Your task is to compute the maximum sum of any contiguous subarray of length k.
For a given array A, a subarray starting at index i (0-indexed) of length k is defined as:
$$\sum_{j=i}^{i+k-1} A[j]$$
You must find the maximum among all such sums.
inputFormat
The first line of input contains two space-separated integers n and k where n is the number of elements in the array and k is the length of the subarray.
The second line contains n space-separated integers representing the elements of the array.
outputFormat
Output a single integer, which is the maximum sum of any contiguous subarray of length k.
## sample10 3
1 2 3 4 5 6 7 8 9 10
27
</p>