Ad
Games
Arrays
Data Types
Algorithms
Logic
Code
Diff
  • using System;
    public static class Kata
    {
            public static int CalculatingTheAmountEnergy(int[] coordinates)
            {
                int result = 0;
    
                for (int i = 0; i < coordinates.Length -1; i++)
                {
                    result += Math.Abs(coordinates[i] - coordinates[i+1]);
                }
    
                return result;
            }
    }
    • using System;
    • public static class Kata
    • {
    • public static int CalculatingTheAmountEnergy(int[] coordinates)
    • {
    • // here's your code
    • }
    • public static int CalculatingTheAmountEnergy(int[] coordinates)
    • {
    • int result = 0;
    • for (int i = 0; i < coordinates.Length -1; i++)
    • {
    • result += Math.Abs(coordinates[i] - coordinates[i+1]);
    • }
    • return result;
    • }
    • }