Thence interview question

Explain your solution to the problem statement.