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.
int left = 0;
int right = 0 ;
int indexRight = arr.Count();
for(int x=0; x < arr.Count(); x ++){
indexRight --;
left += arr[x][x];
right += arr[x][indexRight];
}
if(left > right)
return left - right;
else
return right - left;
Cookie support is required to access HackerRank
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 →
int left = 0; int right = 0 ; int indexRight = arr.Count();