CodeMentor.
Ask AIProblemsLearnC++TCSCore CSHRProgress
0Lv 1
ProblemsHackerRank Warmup

Diagonal Difference

Easy
HackerRank
4/12
EasyHackerRank Warmup

Diagonal Difference

Square matrix. Primary diagonal is a[i][i]. Secondary is a[i][n-1-i]. Return absolute difference of the two sums.

Examples

Example 1

Input

3
11 2 4
4 5 6
10 8 -12

Output

4

Stuck? Take a nudge

C++17Autosaves