You are viewing a single comment's thread. Return to all comments →
n = len(arr) primary_diagonal_sum = 0 secondary_diagonal_sum = 0 for i in range(n): primary_diagonal_sum += arr[i][i] secondary_diagonal_sum += arr[i][n - i - 1] return abs(primary_diagonal_sum - secondary_diagonal_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 →