You are viewing a single comment's thread. Return to all comments →
one loop
int diagonalDifference(vector<vector<int>> arr) { int sum1 = 0; int sum2 = 0; int j = arr.size()-1; for(int i = 0; i < arr.size(); i++){ sum1 += arr[i][i]; sum2 += arr[i][j]; j--; } return abs(sum1-sum2);
} `
Diagonal Difference
You are viewing a single comment's thread. Return to all comments →
one loop
} `