Java Solution
```\nclass Solution {\n    public int diagonalSum(int[][] mat) {\n        int sum1 = 0;\n        int sum2 = 0;\n        int n = mat.length;\n        for(int i =
```\nclass Solution {\n    public int diagonalSum(int[][] mat) {\n        int sum1 = 0;\n        int sum2 = 0;\n        int n = mat.length;\n        for(int i = 0 ; i < n ; i++)\n        {\n            sum1 += mat[i][i];\n            sum2 += mat[i][n-i-1];\n        }\n        int res = sum1 + sum2;\n        if(n%2 != 0)\n        {\n            res -= mat[n/2][n/2];\n        }\n        return res;\n    }\n}
['Java']