01 April 2017

Make Array Consecutive 2

My solution:
int makeArrayConsecutive2(int[] statues)
{
    int min = statues.Min();
    int max = statues.Max();
    int st = 0;
    for (int i = min; i <= max; i++)
        if (!statues.Contains(i))
            st++;

    return st;
}

Previous Next