You are viewing a single comment's thread. Return to all comments →
int diagonalDifference(vector<vector<int>> arr) { int sum = 0; int n = arr.size(); for(int i = 0; i < n; i++){ sum += (arr[i][i] - arr[i][n-i-1]); } return abs(sum); }
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 →
C++ O(n)