somme maximale d'éléments non adjacents

public static void NumbersSumb(int[] arr)
{
    if(arr.Length <=2)
      	Console.WriteLine(arr.Max());

    arr[2] = arr[0] + Math.Max(0, arr[2]);

    for (int i = 3; i < arr.Length; i++)
      	arr[i] = Math.Max(arr[i - 2], arr[i - 3]) + Math.Max(0, arr[i]);

    Console.WriteLine(Math.Max(arr[arr.Length - 1], arr[arr.Length - 2]));
}
PrashantUnity