Dynamic Programming Approach Algorithm And Complexity