Problem

Square grid: sum main diagonal.

Examples

  • mainDiagonalSum([[1, 0], [0, 2]]) -> 3
Compile and test (Ctrl+Enter)