天天看点

[LintCode] Backpack VI 背包之六

Given an integer array <code>nums</code> with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer <code>target</code>.

The different sequences are counted as different combinations.

Have you met this question in a real interview? 

Yes

Example

Given nums = <code>[1, 2, 4]</code>, target = <code>4</code>

return <code>6</code>

解法一:

解法二: