Solution developed in Scala to different problems