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