[ Java ] Beats 100% and super easy to understand
Please Upvote if you like this approach\nComment for Clarifications/Doubts\n\n\nclass Solution {\n    public int diagonalSum(int[][] mat) {\n        int n = mat
Please Upvote if you like this approach\nComment for Clarifications/Doubts\n\n```\nclass Solution {\n    public int diagonalSum(int[][] mat) {\n        int n = mat.length;\n        int sum = 0;\n        \n        //Summing up diagonal 1\n        for(int i=0;i<n;i++){\n            sum += mat[i][i];\n        }\n        \n        //Summing up diagonal 2\n        for(int i=0;i<n;i++){\n            sum += mat[i][n-i-1];\n        }\n        \n        //If element repeating (in case n odd) subtracting that\n        if(n%2==1){\n            sum -= mat[n/2][n/2];\n        }\n        return sum;\n    }\n}\n```
['Java']