Last active
September 8, 2016 06:56
-
-
Save mateuszmrozewski/7238537 to your computer and use it in GitHub Desktop.
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
object S99_P19 { | |
def rotate[T](n: Int, ts: Seq[T]): Seq[T] = (n, ts) match { | |
case (_, Nil) => Nil | |
case (0, seq) => seq | |
case (x, seq) => rotate(x - 1, seq.last +: seq take seq.length - 1) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment