problem 5 - recursive solution