Problem Statement
A description of the problem can be found on Hackerrank.
Solution
1 2 3 4 |
object UpdateList extends App { def f(arr: List[Int]): List[Int] = if (arr.isEmpty) Nil else arr.head.abs :: f(arr.tail) } |
Solution also available on my GitHub.