Basic Algorithmic Challenges in Scala