Approach for 0-1 Knapsack using DP

Can you explain how to proceed using top down and also bottom up

my suggest would be to first think of the recursive solution for this problem , then try to optimize it using memoization (that will be your top-down approach) and then you can try bottom-up approach (tabulation)

If you want hint for recursive solution then do ask me after trying by yourself

https://ide.codingblocks.com/s/238944 why i am not getting the correct answer

Got the issue …Now working fine

great !! In case of any doubt feel free to ask :slight_smile: