Minimum Money Needed Program

First test cases is failing and other two are passing

you have used 1D array for storage which is not sufficient . You are only storing the value at the index of wt array which is insufficient as wt is also varying . Use a 2D array for the problem , index vs weight type structure.

1 Like