You are viewing a single comment's thread. Return to all comments →
To create this group for all elements in the upper-left quadrant, use 2 for loops.
groups = [] for x in range(n): for y in range(n): groups.append([matrix[x][y], matrix[2n-1-x][y], matrix[x][2n-1-y], matrix[2n-1-x][2n-1-y]])
Then loop through groups to find max of each list, and sum them up.
Seems like cookies are disabled on this browser, please enable them to open this website
Flipping the Matrix
You are viewing a single comment's thread. Return to all comments →
To create this group for all elements in the upper-left quadrant, use 2 for loops.
groups = [] for x in range(n): for y in range(n): groups.append([matrix[x][y], matrix[2n-1-x][y], matrix[x][2n-1-y], matrix[2n-1-x][2n-1-y]])
Then loop through groups to find max of each list, and sum them up.