C++ solution | array | O(1) space | fast than 93% | easy
\nint diagonalSum(vector<vector<int>>& mat) {\n\tint n= mat.size(), sum=0;\n\tfor(int i=0; i<n; i++){\n\t\tsum+=mat[i][i];\n\t\tsum+=mat[i][n-i-1];\n\t}\n\n\tif
```\nint diagonalSum(vector<vector<int>>& mat) {\n\tint n= mat.size(), sum=0;\n\tfor(int i=0; i<n; i++){\n\t\tsum+=mat[i][i];\n\t\tsum+=mat[i][n-i-1];\n\t}\n\n\tif(n%2)\n\t\tsum-= mat[n/2][n/2];\n\treturn sum;\n}\n```
['Array', 'C', 'Matrix', 'C++']