Untitled
unknown
javascript
2 years ago
228 B
5
Indexable
Never
let sum = 0; let len = mat.length; for (let i = 0; i < len; i++) { if(i != mat[i].length - i - 1) { sum += mat[i][i] + mat[i][mat[i].length - i - 1]; } else{ sum += mat[i][i]; } } console.log(sum);