Easy and Direct Method
Upvote if u find useful\n\nclass Solution {\n    public int diagonalSum(int[][] mat) {\n        int n = mat.length;\n        int sum = 0;\n        for(int i=0; 
**Upvote if u find useful**\n```\nclass Solution {\n    public int diagonalSum(int[][] mat) {\n        int n = mat.length;\n        int sum = 0;\n        for(int i=0; i<n; i++){\n         \n              sum=sum + mat[i][i];\n           }\n        for(int i=0; i<n; i++){\n            sum = sum + mat[i][n-1-i];\n        }\n        if(n%2 != 0){\n        sum = sum - mat[n/2][n/2];\n        }\n        return sum;\n        }\n        \n\n    }\n\n```
['Java']