Skip to content

Instantly share code, notes, and snippets.

@polyglotpiglet
polyglotpiglet / Rotation.scala
Created February 25, 2016 12:51
Matrix rotation
object Rotation extends App {
val matrix = Array(Array(1,2), Array(3,4), Array(5,6))
print(matrix)
print(transpose(matrix))
print(rotate90(matrix))
print(rotateMinus90(matrix))
def transpose(matrix: Array[Array[Int]]): Array[Array[Int]] = {