I’m trying to solve the coin-change DP problem. I’m making DP array with a bottom approach with the recurrence relation as dp[i]+=dp[i-S[j]] where S is the array of coins available and is of size m. The following is my code what I observed is my recurrence relation is not mutually exclusive since its adding some recurrences again.

```
long long int count( int S[], int m, int n )
{
int dp[n+1]={0};
dp[0]=1;
for(int i=1; i<=n; i++){
for(int j=0; j<m; j++){
if(i-S[j]<0) continue;
dp[i] += dp[i-S[j]];
}
}
return dp[n];
//code here.
}
```