Skip to content

Commit

Permalink
20210128动规周末总结:修改目标和 动规五部曲步骤1和2中 i 和 j 的错误使用
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoyangu committed Dec 20, 2021
1 parent 70d779d commit a273e8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions problems/周总结/20210128动规周末总结.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ S 和 sum都是固定的,那此时问题就转化为01背包问题(数列中

1. 确定dp数组以及下标的含义

**dp[j] 表示:填满j(包括j)这么大容积的包,有dp[i]种方法**
**dp[j] 表示:填满j(包括j)这么大容积的包,有dp[j]种方法**

2. 确定递推公式

dp[i] += dp[j - nums[j]]
dp[j] += dp[j - nums[i]]

**注意:求装满背包有几种方法类似的题目,递推公式基本都是这样的**

Expand Down

0 comments on commit a273e8f

Please sign in to comment.