注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
背包问题 6 的二维数组解法
一维的网上都有,我写了个二维的 但是感觉不是很好
大家有二维的写法么?
Given an integer array nums with all positive numbers and no duplicates,
find the number of possible combinations that add up to a positive integer target.
Examples 1
Given nums = [1, 2, 4], target = 4
The possible combination ways are:
[1, 1, 1, 1]
[1, 1, 2]
[1, 2, 1]
[2, 1, 1]
[2, 2]
[4]
return 6
Example 2:
Given nums = [3, 4, 5], target = 1
return 0 |