Diagonal Difference

  • + 0 comments
     public static int diagonalDifference(List<List<int>> arr)
        {
            int finalresult = 0;
            
            for(int i = 0; i < arr.Count(); i++){
                finalresult += arr[i][i] - arr[i][arr.Count() - i - 1]; 
            }
            
            return Math.Abs(finalresult);
        }