Problem Statement
A description of the problem can be found on Hackerrank.
Solution
1 2 3 4 5 6 7 8 |
object FilterArray extends App { def f(num: Int, arr: List[Int]): List[Int] = arr.filter(_ < num) var lines = io.Source.stdin.getLines.toList println(f(lines(0).toInt, lines.map(_.trim).map(_.toInt)).map(_.toString).mkString("\n")) } |
Solution also available on my GitHub.