Exchanging Coins

I am getting MLE for this question but how will we solve it if the constraints are so large without forming an array of that size?

hi @aryamaan1011 use a hash map to store the dp states

How would that make a difference ? Plz rectify the code for me…is there a problem in logic or is it due to memory constraint?

@aryamaan1011 if you use an array you’ll have to use all the states but the constraints are high so you cant occupy that much memory. Not all dp states are actually needed so better to use a hash map for memory optimisation

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.