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