Flipping The Matrix
Published:
1. Find the length
length := len(matrix)
2. Find the quadrant
quadrantSize := length / 2
3. read and fully understand the behavior
4. Get the top-left, top-righht (its mirror / opposite), bottom left, and bottom-right (its opposite)
for i := 0; i < quadrantSize; i++ {
for j:= 0; j < quadrantSize; j++ {
topLeft := matrix[i][j]
topRight := matrix[i][length - 1 - j]
bottomLeft := matrix[length - 1 - i][j]
bottomRight := matrix[length - 1 - i][length - 1 - j]
sum += max(topLeft, topRight, bottomLeft, bottomRight)
}
}