Problem 19
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package ninetyNineScalaProblems
|
||||
|
||||
|
||||
object Problem19:
|
||||
def rotateLeft(n: Int, list: List[Any]): List[Any] =
|
||||
list match
|
||||
case Nil =>
|
||||
list
|
||||
case _ =>
|
||||
val splitIndex = (list.length + n) % list.length
|
||||
Problem18.slice(splitIndex, list.length, list) ::: Problem18.slice(0, splitIndex, list)
|
||||
Reference in New Issue
Block a user