updated 99problems: slice solution optimized -> tail recuisive and use one additional function