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
August 27, 2024
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
Don't have an account? We will create one for you.
Enter the OTP send to
in seconds. Check your spam folder if you can't find email from us.
Valid email is required for further communications