Greedy algorithm to min weight sum