Pregunta de entrevista de Meta

Leet code question, hard difficulty level, recursion.