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