Pregunta de entrevista de Accenture

Explain the thought behind the solution.