Solutions of Hackerrank challenges in Scala