java faster 100%
\nclass Solution {\n    public int diagonalSum(int[][] mat) {\n        boolean a = mat.length % 2 == 1;\n        int b = mat.length / 2;\n        int res = 0;\n
```\nclass Solution {\n    public int diagonalSum(int[][] mat) {\n        boolean a = mat.length % 2 == 1;\n        int b = mat.length / 2;\n        int res = 0;\n        for (int i = 0, index = mat.length - 1; i < mat.length; i++, index--) {\n            int c = i == b && a ? 0 : mat[i][index];\n            res += mat[i][i] + c;\n        }\n        return res;\n    }\n}\n```
['Java']