Exchanging Coins

I am using top down dp(recursion + memoization) still getting runtime error. Please help.

hello @vaishnavtannu
value of n can be upto 10^9 and we can not declare array of that big size because it will take too much memory.
so use map in place of array.

Can we use vector instead?

no … . . . . . . . . .
vector is like array only so that will also take too much memory.
simply declare map and use it like array.