Google interview question

How can you optimize this more