You are viewing a single comment's thread. Return to all comments →
public static int diagonalDifference(List> arr) { int n = arr.size(); /// tam de la matriz int diagnonalPrincipal = 0; int diagonalSecundaria = 0;
for(int i = 0; i<n;i++){ diagnonalPrincipal += arr.get(i).get(i); diagonalSecundaria += arr.get(i).get(n-1-i); } return Math.abs(diagnonalPrincipal - diagonalSecundaria); }
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 →
public static int diagonalDifference(List> arr) { int n = arr.size(); /// tam de la matriz int diagnonalPrincipal = 0; int diagonalSecundaria = 0;