IBM interview question

Question related to greedy algorithm