MORSE Corp interview question

How would you make this solution more efficient?