Google interview question

Greedy algorithm