Skip to content
New issue

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

动态规划背包问题代码有误 #181

Open
tiamed opened this issue Dec 5, 2019 · 1 comment
Open

动态规划背包问题代码有误 #181

tiamed opened this issue Dec 5, 2019 · 1 comment

Comments

@tiamed
Copy link

tiamed commented Dec 5, 2019

动态规划里的背包问题代码有误
如:运行knapsack([2,2,6,5,4],[6,3,5,4,6],10),结果应该为15,但实际为18

@tiamed
Copy link
Author

tiamed commented Dec 7, 2019

let array = new Array(length).fill(new Array(C + 1).fill(null))

改为

let array = new Array(length).fill().map(() => new Array(C + 1).fill(null))

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

No branches or pull requests

1 participant