✅Simple | Single Loop O(n) | 0ms solution | very unique way | With Explanation
\nclass Solution {\n    public int diagonalSum(int[][] mat) {\n        int row = 0, col = mat.length-1;\n        int firstDiagonalSum = 0, secondDiagonalSum = 0
```\nclass Solution {\n    public int diagonalSum(int[][] mat) {\n        int row = 0, col = mat.length-1;\n        int firstDiagonalSum = 0, secondDiagonalSum = 0;\n        \n        while(row<mat.length){\n            firstDiagonalSum += mat[row][row]; // 00 , 11, 22\n            if(row!=col){\n                secondDiagonalSum +=mat[row][col];  //02, 11, 20\n            }\n            row++; //next row\n            col--;   //  next col\n        }\n        \n        return firstDiagonalSum+secondDiagonalSum;\n    }\n```\n\n\nwe are decrementing L (column) </br>\nfor each i (row)\n\n| 00|      01|  ``02``  |\n|----------|:-------------:|------:|\n| **10** |   ``11``  | **12** |\n| ``20``   |  **21**  |  **22** |\n\nSkipping <b>intersection</b> of diagonal element for <code>secoundDiagonalSum</code><br>\nAs,  center is added in <code>firstDiagonalSum.</code>\n\n\n-  linear time\n\n-  less complex Solution\n   \n
['Java']