結果 : differentiate greedy method and dynamic programming with examples