greedy algorithm solution added