Google interview question

Only algorithm problems are involved