Tell me about a time you implemented a complex recursion solution and ensured it was correct and efficient.