Rotating a matrix
Question
Suppose you are given matrix M, with dimensions N by N. Write a function that rotates the matrix M by 90 degrees in either direction (clockwise or counterclockwise).
For example, if you're given the following matrix:
[[4, 6, 7],
[2, 3, 8],
[9, 10, 23]]
Your function should return the following if you're rotating clockwise:
[[9, 2, 4],
[10, 3, 6],
[23, 8, 7]]
...and if you're rotating counterclockwise, it should return:
[[7, 8, 23],
[6, 3, 10],
[4, 2, 9]]