Accenture interview question

Explain the thought behind the solution.