Algorithm · Capital One · Medium
Problem Given a square matrix and a value turns, rotate the matrix turns times according to its two main diagonals, and return the resulting matrix. Entries located on either main diagonal must remain unchanged. The four regions separated by those diagonals move clockwise from one region to the next after each rotation. Implement the following operation: Constraints matrix is square. turns specifies how many rotations to perform. Values on both main diagonals are not moved.…