I can’t figure out mymistake
One wrong ans in minimum money needed
In the ‘min’ function, in the ‘if’ and ‘else’ blocks after the (j==0) and (i==0) ‘if’ blocks, ‘i’ should be ‘i-1’ in some places. This is because, essentially these blocks will execute for i=1 for the first time . So, in the weight and value arraylists, the 0th index is not being accessed. It is directly using the 2nd elements from these arraylists.
It is a little confusing, I hope you understand. If it is not clear, let me know!
If you have no further queries, please mark the doubt as resolved
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.