HEMA Interview Question

How do you improve the solution?