You are viewing a single comment's thread. Return to all comments →
Javascript Solution:
let prime = [] let second = [] for(let i =0; i< arr.length;i++){ for(let j = 0; j< arr[i].length;j++){ if(i===j) prime.push(arr[i][j]) if(j+i === arr.length-1)second.push(arr[i][j]) } } return Math.abs(prime.reduce((a,b) => a+b)-second.reduce((a,b) => a+b))
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 →
Javascript Solution: