You are viewing a single comment's thread. Return to all comments →
int f_diag{},s_diag{}; int col=arr[1].size()-1; for(int row=0;row<arr[0].size();row++) { f_diag+=arr[row][row]; s_diag+=arr[col][row]; col--; } return abs(f_diag-s_diag);
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Diagonal Difference
You are viewing a single comment's thread. Return to all comments →