C++ Solution | Easy | O(n) runtime
```\nclass Solution {\npublic:\n    int diagonalSum(vector>& mat) {\n        int n=mat.size(),ans=0;\n        for(int i=0;i<n;i++){\n            if(i!=n-i-1) an
```\nclass Solution {\npublic:\n    int diagonalSum(vector<vector<int>>& mat) {\n        int n=mat.size(),ans=0;\n        for(int i=0;i<n;i++){\n            if(i!=n-i-1) ans+=mat[i][i]+mat[i][n-i-1];\n            else ans+=mat[i][i];   \n        }\n        return ans;\n    }\n};
[]