Square Matrix Rotation and Reflections
Problem statement
Apply query codes to a square matrix in order: 0 rotates 90 degrees clockwise, 1 reflects across the main diagonal, and 2 reflects across the secondary diagonal. Return the final matrix.
Function
applyMatrixTransforms(matrix: int[][], queries: int[]) → int[][]Examples
Example 1
matrix = [[1,2],[3,4]]queries = [0]return = [[3,1],[4,2]]One clockwise quarter-turn is applied.
Example 2
matrix = [[1,2],[3,4]]queries = [1]return = [[1,3],[2,4]]Main-diagonal reflection transposes the matrix.
Constraints
1 <= n <= 200- Every query is 0, 1, or 2.