Greedy Algorithm And Dynamic Programming Time