Skip to content

Conversation

hoxiansen
Copy link
Contributor

在学到动态规划完全背包这部分时候,零钱兑换II 这道题直接就开始从一维数组开始讲,对我来说跨度有点大了。

我一直没有理解,直到我看了其他人写的状态转移方程:f[i][j] = max(f[i-1][j-kw[i]] + kv[i]) (0 <= k*w[i] <= j) ,然后摸索出了这个二维数组版本的代码,个人感觉对于理解完全背包更直观一点。

代码可以AC,只是耗时垫底(doge

@youngyangyang04 youngyangyang04 merged commit 5f20987 into youngyangyang04:master Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants