Google interview question

How would you approach this question?