August 27, 2024

P02 - Find the last but one element of a list.

Example:

scala

scala> penultimate(List(1, 1, 2, 3, 5, 8))
res0: Int = 5
Be first to comment
Leave a reply