You are viewing a single comment's thread. Return to all comments →
def diagonalDifference(arr): ROWS = len(arr) res = 0 for i in range(ROWS): diff = (arr[i][i] - arr[i][ROWS-1-i]) res += diffreturn abs(res)
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 →
O(n) solution: