i used prateek bhaiya’s method for 0-1 knapsack in the recursion video and tried to solve this problem in dp section but its throwing TLE for 2 test cases in this, pls help.
0-1 knapsack recursion
hi @skaushik.46, your code is correct but the complexity of your code is 2^(min(s,n)) which is a very large value and can’t be executed in 1s, so you have to optimize your solution further using dynamic programming, either by memoization or tabulation,
I have optimized your code using memoization technique:-
In case of any doubt feel free to ask 
Marj your doubt as RESOLVED if you got the answer