Google interview question

How would I code better?