You are viewing a single comment's thread. Return to all comments →
I have two solution
def diagonalDifference(arr): a, b =0, 0 for i in range(n): a += arr[i][i] b += arr[i][-(i+1)] return abs(a-b)
second
def diagonalDifference(arr): diag = [arr[i][i] - arr[n-1-i][i] for i in range(n)] return abs(sum(diag))
Seems like cookies are disabled on this browser, please enable them to open this website
The Minion Game
You are viewing a single comment's thread. Return to all comments →
I have two solution
second