01 April 2017

alternatingSums

My solution:
int[] alternatingSums(int[] a)
{
    return new[] { a.Where((b, c) => c % 2 == 0).Sum(), a.Where((b, c) => c % 2 == 1).Sum() };
}

Previous Next