Discover interview question

Q: How would you improve this solution?