I think it's quite similar to coin change problem. We just need to regard nums as a set of coins with different denominations and target is the amount of money. Coins are unlimited. We should find the first smallest amount of money for which we can make change and set the initial number of coin combination as 1 for it. Then we just need to record the number of combinations we can make change for a specific amount of money and develop a DP algorithm for this question. The complexity is O(n*target), n is the size of nums.

**Update(for fun):**

If you can solve this question with the idea mentioned above, you can also try to solve this one :)

http://www.geeksforgeeks.org/dynamic-programming-set-7-coin-change/

```
class Solution {
public:
int combinationSum4(vector<int>& nums, int target) {
if (nums.size() == 0 || target <= 0) return 0;
vector<int> dp(target + 1, 0);
dp[0] = 1;
for (int i = 1; i <= target; ++i)
for (int j = 0; j < nums.size(); ++j)
if (nums[j] <= i) dp[i] += dp[i - nums[j]];
return dp[target];
}
};
```