Minimum money neede

doubt : Need some clarity 1. if 2, 4, - 5 is value than the weight array should be 1 , 2, 3 or weight array will just be constructed for 2 5 as 1 , 3 or 1 , 2 2. which is the case when bag can’t be filled because according to me since there are infinite items it will always be filled(give an example)

this my code link : https://ide.codingblocks.com/s/188765
please correct it and specify my error

Hey @Divya_321

Let’s say you have input array size as N.
If N = 4 and array is 3, 5, 1, 8
Then weights will be 1, 2, 3, 4
i.e. for ith element in input weight will be i ( 1 indexed )

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.