Thoughtworks interview question

Q: Can you optimise the solution?