C++ || Efficient || TC : O(N), SC : O(1) || clean solution || with Exp ||
please upvote, if u find its helpful :)\n\nclass Solution {\npublic:\n    int diagonalSum(vector<vector<int>>& mat) {\n        int d1=0,d2=0;\n        int row=m
##### *please upvote, if u find its helpful :)*\n```\nclass Solution {\npublic:\n    int diagonalSum(vector<vector<int>>& mat) {\n        int d1=0,d2=0;\n        int row=mat.size();\n        int col=mat[0].size();\n        \n        for(int i=0;i<row;i++){\n            d1+=mat[i][i];//Left diagonal where  i==j (here, I have kept i=j)\n            d2+=mat[i][col-1-i];//Right Diagonal where i==row-i-1\n        }\n\t\t//Check if the we have a common diagonal. If yes, then remove it.\n        if(row%2!=0){\n            d1-=mat[row/2][col/2];\n        }\n        return d1+d2;\n    }\n};\n```
['C', 'C++']