What is the difference b/w the 2 methods in the following code

which method is dp…method1 or method2 or both

@Narasimha,
First method is the DP method. Second method is the recursive method.

In the recursive method, we make calls for each number and it has a high complexity.

We don’t need such recursive calls. To avoid this we use DP method.