Diagonal Difference

  • + 0 comments

    Only read if you have attempted to solve the problem

    The key to solving this problem is finding the relationship between the row and column index positions when iterating through the 2d array.

    For the main diagonal, the row and column indices will always be equal.

    For the secondary diagonal, the column index will decrease as each row increases. This relationship can be described as col_index = (arr.size() - row_index - 1).