← Return

Diagonal DifferenceEasy

Given a square matrix, calculate the absolute difference between the sums of its diagonals.

For example, the square matrix \(arr\) is shown below:

1 2 3
4 5 6
9 8 9

Their absolute difference is \(|15 - 17| = 2\).