Exchange coin problem

i’ve tried with all possible custom cases as far i know but still cant getting why i m getting both test cases wrong on submission…please help…?

@nikhilmeena
hello nikhil,
value of n can be upto 10^9 but ur dp array size is 10^6 so following shown snippet will give error.
when n> 10^6 (i.e size of dp array)
image

but how can i deal with 10^9 size array, when i declaring an dp array of size 10^9 it gives an error…?

@nikhilmeena
use top down dp and map

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.