Add tail recursive scala solution