Money change - DP

only two test cases are passed others get run errors
ide:https://ide.codingblocks.com/s/253199

hello @Vishal123
your logic is correct , may be it is not passing due to to much memory allocation.
to avoid that use linear dp.

image