[Java] Short Straightforward Solution with Explanation!!
\npublic int diagonalSum(int[][] mat) {\n        int res = 0;\n        int n = mat.length;\n        for (int i=0; i<n; i++) {\n            res += mat[i][i]; // 
```\npublic int diagonalSum(int[][] mat) {\n        int res = 0;\n        int n = mat.length;\n        for (int i=0; i<n; i++) {\n            res += mat[i][i]; // Primary diagonals are row = column! \n            res += mat[n-1-i][i]; // Secondary diagonals are row + column = n-1!\n        }\n        return n % 2 == 0 ? res : res - mat[n/2][n/2]; // if n is a odd number, that mean we have added the center element twice!\n    }\n```
[]