Your question is 2D Array Region Sums. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
OneTrust Data Privacy Impact Assessment workflows can represent control or risk relationships in a square matrix. Given an n x n integer matrix, compute the sums of the four regions formed by its two diagonals.
Exclude every cell on either diagonal: the main diagonal where row == column, and the anti-diagonal where row + column == n - 1. Classify every remaining cell into exactly one region:
Return a dictionary with keys top, bottom, left, and right.
matrix, a square list of lists containing integers.def sum_matrix_regions(matrix):