Replace array element with multiplication of neighbors in Scala
The tricky part of this problem is how to handle the special cases for the start and end of the list, as well as how to handle short lists with fewer than three elements.

The fact that you need to consider up to three elements at a time means that you need a lot of base cases for recursion, though.  It's also undesirable to expose the special cases in the form of the carryOver and useCarryOver parameters.

A better approach would be to take advantage of the List.sliding function.  (Note that .sliding may produce a group with just two elements instead of three, if the input lst has length two.)

def multiplication(lst: List[Int]): List[Int] = lst match {
  case _::_::_ =&gt;
    (lst.head :: lst ++ List(lst.last))
      .sliding(3)
      .map(group =&gt; group.head * group.last)
      .toList
  case _ =&gt; lst
}