1.3 greedy algorithm