Dynamic Programming And Greedy Method