Rotate Matrix 90 Degrees
Medium
arrays
Amazon
Microsoft
Rotate an NxN matrix 90 degrees clockwise. Return the rotated matrix.
Example
rotate_matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
# => [[7, 4, 1], [8, 5, 2], [9, 6, 3]]
Test Cases
Python Editor
Output
Click "Run" to see results...