Solve problems 3,28 using Scala.
Add optimization flag for Scala compilation.