Diagonal Difference

  • + 0 comments

    Here is a Python 3 solution:

    def diagonalDifference(arr: list[list[int]]) -> int:
        return abs(sum(row[i] - row[~i] for i, row in enumerate(arr)))