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.
- Prepare
- Algorithms
- Warmup
- Diagonal Difference
- Discussions
Diagonal Difference
Diagonal Difference
Sort by
recency
|
5835 Discussions
|
Please Login in order to post a comment
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?
O(n) typescript solution