Sinch Interview Question

Explain the solution step by step