Although I solved it using a different method, this method should work too. Please help. I have treated it like unbounded knapsack problem.
Segmentation error in code
hello @anshufirefox
yeah it shuld work , ur approach is correct.
probably becuase of too much memory allocation becusse of dp array and recusion ,stack limit is getting exceeded and it is showing run error
Thanks
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.