Pregunta de entrevista de Meta

Provide your code to get an expected output.