You are viewing a single comment's thread. Return to all comments →
const diagonalSum = (arr) => { let rightDiag = 0 let leftDiag = 0 let j = -1 for (var i = 0; i < arr.length; i++) { j += 1 let k = (arr.length-1-i) rightDiag += arr[i][j] leftDiag += arr[i][k] } return Math.abs(rightDiag-leftDiag) }
Seems like cookies are disabled on this browser, please enable them to open this website
Diagonal Difference
You are viewing a single comment's thread. Return to all comments →