Implement recursive solution for question 11 as well