I am working on classic DP problem: Counting the number of solutions or say a problem like this.

I learned and worked out a DP approach this:

```
ll *dp = new ll[MAX+1];
memset(dp,0,sizeof(dp));
dp[0] = 1;
for(int i = 1; i <= MAX; ++i){
for(int j = 0; j < n && a[j] <= i; ++j){
dp[i]+=(dp[i-a[j]]);
}
}
```

But problem is that it includes repeated permutations as well

for example for input

a[] = {1, 2, 3}

value = 3

It computes for {1,1,1}, {1,2}, {2,1},{3}

How can I avoid these repeated permutations like {1,2} and {2,1}.

Thank you