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
0 - 1 knapsack problem
@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/