August 27, 2024

P03 - Find the Kth element of a list.

By convention, the first element in the list is element 0.

Example:

scala

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