MIN_MONEY_NEEDED


Why this problem can’t be solved using 1d dp array. Where am I going wrong

@swatiguptasg
Your code was correct. but there were ‘W’ options and not ‘N’ options.
“The second line contains W space separated integers in which the i^th^ integer specifies the price of a ‘i’kg apple packet. A value of -1 denotes that the corresponding packet is unavailable”

1 Like