function getMinSum(arr, n) {
let sum = 0;
let minSum = 0
let index = 0;
for (let i = 0; i < n; sum += arr[i++]) ;
minSum = sum;
for (let i = n; i < arr.length; i++) {
sum -= arr[i - n] - arr[i];
if (sum < minSum) {
minSum = sum;
index = i - n + 1;
}
}
return {
sum: minSum,
seq: arr.slice(index, index + n),
};
}