We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
“for v=V..0”这一层循环必须在“for 所有的i属于组k”之外。这样才能保证每一组内的物品最多只有一个会被添加到背包中。 这一句话能详细解释下为什么么?
The text was updated successfully, but these errors were encountered:
在做了空间复杂度优化的时候,存储状态的一维数组 F 中的每个元素计算结果依赖于上一次循环得到的当前位置和当前位置左侧的元素结果,如果 “for v=V..0”这一层循环在“for 所有的i属于组k”之内,将导致当前位置和当前位置左侧的元素受到同组的其他物品影响。如果不做空间复杂度上的优化则不会发生这样的影响,代码 demo 可见https://github.com/DavonChen/LeetCode/blob/master/src/dynamicPlanning/backpack/GroupBackpack.java
Sorry, something went wrong.
No branches or pull requests
“for v=V..0”这一层循环必须在“for 所有的i属于组k”之外。这样才能保证每一组内的物品最多只有一个会被添加到背包中。
这一句话能详细解释下为什么么?
The text was updated successfully, but these errors were encountered: