You are viewing a single comment's thread. Return to all comments →
Java
public static int diagonalDifference(List<List<Integer>> arr) { int leftArr = 0; int rightArr = 0; int i=0; int j=arr.size()-1; while(i<arr.size()){ leftArr = leftArr + arr.get(i).get(i); rightArr = rightArr + arr.get(i).get(j); i++; j--; } return Math.abs(leftArr - rightArr); }
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 →
Java