Solution for basic recursion