Edgescan interview question

How could this solution be improved (in regards to tech test)