We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This is my code using C:
int diagonalDifference(int arr_rows, int arr_columns, int** arr) {
int x = 0;
int y = 0;
for (int i = 0; i < arr_rows; i ++) {
x += arr[i][i];
y += arr[arr_rows - i - 1][i];
}
return abs(x-y);
}
Can some one explain why it is not possible to let int N = arr_rows?
Cookie support is required to access HackerRank
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 →
This is my code using C: int diagonalDifference(int arr_rows, int arr_columns, int** arr) { int x = 0; int y = 0; for (int i = 0; i < arr_rows; i ++) { x += arr[i][i]; y += arr[arr_rows - i - 1][i]; }
return abs(x-y); }
Can some one explain why it is not possible to let int N = arr_rows?