Diagonal Difference

  • + 2 comments

    in python

    def diagonalDifference(arr): # Write your code here i=0 a=-1 l1=[] l2=[] for i in range(len(arr)): l1.append(arr[i][i]) i+=1 for i in range(len(arr)): l2.append(arr[i][a]) a-=1 i+=1 result=(sum(l1)-sum(l2)) return(abs(result))