Diagonal Difference

  • + 30 comments

    My solution is to accumulate the mirrored difference in each row like so:

    N = int(input())
    total = 0
    for i in range(N):
        row = input().split()
        total += int(row[i])-int(row[-(i+1)])
    print(abs(total))
    

    the only conversions are at two indeces per row regardless of size.