Java Solution: 0 ms, faster than 100.00% of Java online submissions
class Solution {\n    public int diagonalSum(int[][] mat) \n1.     {\n        int sum=0;\n        for(int i=0,k=mat.length-1;i<mat.length;i++,k--)\n        {\n 
class Solution {\n    public int diagonalSum(int[][] mat) \n1.     {\n        int sum=0;\n        for(int i=0,k=mat.length-1;i<mat.length;i++,k--)\n        {\n              sum=sum+mat[i][i];\n             \n               if(i!=k)\n               {\n                   sum=sum+mat[i][k];\n               }\n        }\n        return sum;\n    }\n}\n\n\n
[]