Question

Write a function to rotate the matrix by 90 degree clockwise?

Login to Submit

Examples

A matrix 

1 2 3
4 5 6
7 8 9

is represented using JavaScript arrays as [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

The 90 degree clockwise rotated version of above matrix is

7 4 1
8 5 2
9 6 3

which is [[7, 4, 1], [8, 5, 2], [9, 6, 3]]