You are viewing a single comment's thread. Return to all comments →
typescript function diagonalDifference(arr: number[][]): number { let left = 0, right = 0, row = 0; for ( let i = 0, j = arr.length - 1; i < arr.length && j >= 0; i++, j-- ) { left += arr[row][i]; right += arr[row][j]; row++; } return Math.abs(left - right); }
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 →