You are viewing a single comment's thread. Return to all comments →
Actually the above solution was not working for me, so I did the solution without taking the input as it was already described in the main function.
def diagonalDifference(a): # Complete this function sum1 = 0 sum2 = 0 for i in range(n): sum1 += int(a[i][i]) sum2 += int(a[i][n-i-1]) return abs(sum1 - sum2)
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 →
Actually the above solution was not working for me, so I did the solution without taking the input as it was already described in the main function.