Where am i doing wrong in money change ? [dp]

link: https://ide.codingblocks.com/s/279689

only 2 cases got ac and other get run error

hello @dhruv.160410116084
use linear dp .
2dp will take too much space and that is why u r getting run error.

now getting wrong answers for only that cases where they were giving run error.
link: https://ide.codingblocks.com/s/279697

image

u r asked to print answer%mod.

also use modulo proprty while perform addition.
(a+b)%mod=(a%mod+b%mod)%mod

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.