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