Array Rotation in Scala

Array Rotation in Scala object MyClass { def rotateArray(A: Array[Int], K: Int): Array[Int] = { if (A.isEmpty) A else rotate(A.toList, K).toArray } def rotateStepwise(l: List[Int]) = { l.take(l.size - 1).+:(l.last)…

0 Comments