Skip to content

Instantly share code, notes, and snippets.

@Lackoftactics
Created March 6, 2018 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lackoftactics/984d5661a202d6c5d82a6c7d8070c451 to your computer and use it in GitHub Desktop.
Save Lackoftactics/984d5661a202d6c5d82a6c7d8070c451 to your computer and use it in GitHub Desktop.
rotate matrix
You are given an n x n 2D matrix that represents an image. Rotate the image by 90 degrees (clockwise).
Example
For
a = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
the output should be
rotateImage(a) =
[[7, 4, 1],
[8, 5, 2],
[9, 6, 3]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment