ML6 interview question

How would you improve the solution?