Skip to content

Instantly share code, notes, and snippets.

@imouaddine
Created November 10, 2014 14:41
Show Gist options
  • Save imouaddine/8eb29c0a57732b5fab38 to your computer and use it in GitHub Desktop.
Save imouaddine/8eb29c0a57732b5fab38 to your computer and use it in GitHub Desktop.
def rotate_matrix(a, length)
(0).upto(length -1) do |i|
(i+1).upto(length -1) do |j|
a[i][j], a[j][i] = a[j][i], a[i][j]
end
end
a
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment