You are viewing a single comment's thread. Return to all comments →
For Javascript solution:
function diagonalDifference(arr) { let tampung = 0; let tampung2 = 0; let n = arr.length; for(let i=0; i < n; i++){ tampung = tampung + arr[i][i]; tampung2 = tampung2 + arr[i][n - 1 - i]; } return Math.abs(tampung - tampung2); }
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 →
For Javascript solution: