×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Scala
Posted by: osocron coder
Added: Sep 12, 2016 7:13 PM
Views: 6
How to rotate an array
  1. def rotateArray(xs: List[Int], k: Int): List[Int] =
  2.     xs.splitAt(xs.length - k) match {case (x, y) => List(y, x).flatten}