Created
December 23, 2016 22:08
-
-
Save alarsyo/623c7771a0b72a7a5e9a156e75587a4e to your computer and use it in GitHub Desktop.
Matrix rotation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rotateMatrix(matrix): | |
newMatrix = [] | |
l = len(matrix) | |
for i in range(l): | |
newMatrix.append([]) | |
for j in range(l): | |
newMatrix[i].append(matrix[l - 1 - j][i]) | |
return newMatrix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment