✅Simple approach TC O(n)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int diagonalSum(vector<vector<int>>& mat) {\n        int sum=0;\n        int secR=0;\n        int secC=mat[0].size()-1;\n        \n        int priR=0;\n        int priC=0;\n        \n        int n=mat.size();\n        for(int i=0;i<n;i++)\n        {\n            sum += mat[priR++][priC++];\n            sum += mat[secR++][secC--];\n        }\n        //just in this case problem is that in case of the odd metrix it\'s add the middle value twice\n        if(mat.size()%2!=0)\n            sum = sum - mat[mat.size()/2][mat.size()/2];\n        return sum;\n    }\n};\n```
['C++']