Thoughtworks Interview Question

Please explain how you solve the assignment.