Created
December 16, 2022 06:50
-
-
Save themexpride/815185dda32030f5a0acf5c511fe076a to your computer and use it in GitHub Desktop.
Scala. Recurison approach. Used List concatentation to concatenate two seperate lists.
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
def f(arr:List[Int]):List[Int] = { | |
arr match { | |
case Nil => Nil | |
case h::t => f(t):::h::Nil | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment