Pregunta de entrevista de Meta

The question involved deeply nested recursion and search