Run time error for exchanging coin

infact i used dp, it is showing Run time error

Hey @Sus the problem is that n can be as large as 10^9, if n is 10^9 your function will check dp[5 * 10 ^8], which is out of bounds. Please use map for memoization.

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.