Dp problem of couting minimum coins

my code : https://ide.codingblocks.com/s/108973

question link:
https://practice.geeksforgeeks.org/problems/coin-change/0

Hello @amanm2292,

You have to count the total number of solutions,
we can divide all set solutions into two sets:

  1. Solutions that do not contain mth coin (or Sm).
  2. Solutions that contain at least one Sm.

Let count(S[], m, n) be the function to count the number of solutions, then it can be written as sum of count(S[], m-1, n) and count(S[], m, n-Sm).

I have written a code to implement above:

I have added the necessary comments for better understanding.

If you want to ask something else, let me know.
Hope, this would help.
Give a like, if you are satisfied.

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.