Added recursive solution

More elegant solution using recursion.