(int[][] mat)
| 8 | */ |
| 9 | class Solution { |
| 10 | public int diagonalSum(int[][] mat) { |
| 11 | |
| 12 | int diagonalSum = 0; |
| 13 | int len = mat.length - 1; |
| 14 | |
| 15 | for(int i=0; i<mat.length; i++){ |
| 16 | for(int j=0; j<mat[i].length; j++){ |
| 17 | |
| 18 | if(i == j){ |
| 19 | diagonalSum += mat[i][j]; |
| 20 | } |
| 21 | else if(i == (len-j)){ |
| 22 | diagonalSum += mat[i][j]; |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | return diagonalSum; |
| 28 | } |
| 29 | } |
nothing calls this directly
no outgoing calls
no test coverage detected