Problem 2 solved using recurssion