ML6 Interview Question

How would you improve the solution?