Greedy and Dynamic Programming