0 - 1 knapsack problem

https://ide.codingblocks.com/s/200822 please see the code…all test cases not passing…i tried the solution with both greedy and dp approach

@Bansaljatin05
hello jatin,
a) greedy approach will not work
b) in func2 u are initlailing dp with -1 for each call which is wrong
c) we need 2d dp array for memosiation .

pls refer this article -> https://www.geeksforgeeks.org/0-1-knapsack-problem-dp-10/