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