Problem Statement
A description of the problem can be found on Hackerrank.
Solution
1 2 3 4 5 6 7 8 9 10 |
object ListLength extends App { def f(arr: List[Int]): Int = { var count = 0 for (i <- arr) count += 1 count } println(f(io.Source.stdin.getLines.toList.map(_.trim).map(_.toInt))) } |
Solution also available on my GitHub.