You are viewing a single comment's thread. Return to all comments →
Python:
def diagonalDifference(arr): left, right = 0, 0 for i in range(len(arr)): for j in range(len(arr[i])): if i == j: left += arr[i][j] if j == len(arr[i]) - 1 - i: right += arr[i][j] return abs(left - right)
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 →
Python: