Minimum money needed

Please tell why I am getting incorrect output ?

hello @vaishnavtannu
image
u are not reading w.

Still getting wrong answer.


there were some minute mistakes.
a) dp[i][0] =0 and dp[0][i]=INT_MAX u were doing opposite
b) n= val.size()
c) in if condition it should be j < wt[i-1] but u were using j > wt[i-1]