Matrix Diagonal Sum
Medium · rating 1300 · Matrix
The first line has n. The next n lines each have n integers. Print the sum of both diagonals; if n is odd, the centre element (shared by both) is counted once.
Constraints: 1 ≤ n ≤ 1000
Related problems
- Boustrophedon Seat — Medium
- Heaviest Row — Medium
- Rotate Matrix 90° — Medium
- Spiral Order — Medium
- Set Matrix Zeroes — Hard
- Minimum Path Sum — Hard