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