eccenca Interview Question

Explain the solution for the coding challenge