Diagonal Difference

  • + 0 comments

    Python solution

    from functools import reduce
    import operator
    
    def diagonalDifference(arr):
        # Write your code here
        size = len(arr)
        return abs(reduce(operator.add, [arr[x][x] - arr[x][size-1-x] for x in range(size)]))