You are viewing a single comment's thread. Return to all comments →
For Scala
import scala.math._ def f(arr:List[Int]):List[Int] = arr.map((a:Int) => abs(a))
I feel it was a bit of cop out using the abs() function. Does anyone have a method to solve it using something tail recursive?
Update List
You are viewing a single comment's thread. Return to all comments →
For Scala
I feel it was a bit of cop out using the abs() function. Does anyone have a method to solve it using something tail recursive?