Java 100% Faster Solution, 4 lines of code
\n    // Runtime = 0 ms, memory = 39.2 MB\n    public int diagonalSum(int[][] mat) {\n        int sumDiagonal = 0;\n        for (int i = 0, j = mat.length - 1; 
```\n    // Runtime = 0 ms, memory = 39.2 MB\n    public int diagonalSum(int[][] mat) {\n        int sumDiagonal = 0;\n        for (int i = 0, j = mat.length - 1; i < mat.length; i++, j--) {\n            sumDiagonal += mat[i][i] + ((i != j) ? mat[i][j] : 0);\n        }\n        return sumDiagonal;\n    }\n```
['Java']