Sinch interview question

Explain the solution step by step