You are viewing a single comment's thread. Return to all comments →
Similar to my version:
let sum = 0; for (let i = 0; i < n; i++) { sum += a[i][i] - a[i][n-1-i]; } console.log(sum >= 0 ? sum : sum * -1);
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 →
Similar to my version: