Rotate Image

Medium
ArrayMatrixAmazonApple
Given an n x n matrix representing an image, rotate it by 90 degrees clockwise and print the result. Input format: - First line: n - Next n lines: n integers each Print the rotated matrix, one row per line.

Constraints

1 <= n <= 1000
1 <= n * n <= 2 * 10^5
-10^9 <= matrix[i][j] <= 10^9

Sample tests

Sample 1

Sample 2

Sign in to submit