• + 5 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?