Add Scala solution for problem 1.