public class Solution
{
public int MaxScore(int[] c, int k)
{
var wSize = c.Length - k;
var sum = c.Sum();
var res = 0;
var temp = 0;
var j = 0;
for (var i = 0; i < c.Length; i++)
{
temp += c[i];
if (i < wSize)
{
if(i==wSize-1)
{
res = Math.Max(res, sum - temp);
}
continue;
}
temp -= c[j++];
res = Math.Max(res, sum - temp);
}
return res;
}
}