Java 0 ms, faster than 100.00%
If you like it pls upvote\n\n\n\n\n\npublic int diagonalSum(int[][] mat) {\n    int size = mat.length-1, res = 0, mid = 0;\n\n    if (mat.length % 2 == 1) \n   
If you like it pls upvote\n![image](https://assets.leetcode.com/users/images/906636ae-2026-4558-bbd1-fb0b85d3d820_1667978927.3318133.png)\n\n\n```\n\npublic int diagonalSum(int[][] mat) {\n    int size = mat.length-1, res = 0, mid = 0;\n\n    if (mat.length % 2 == 1) \n        mid = mat[mat.length / 2][mat.length / 2];\n\n    for (int j = 0; j < mat.length; j++) \n        res += mat[j][j] + mat[j][size--];\n\n    return res - mid;\n}\n\n```
['Matrix']