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

面试题14:剪绳子,题目存在问题 #64

Open
Honeylemonade opened this issue Oct 7, 2019 · 3 comments
Open

面试题14:剪绳子,题目存在问题 #64

Honeylemonade opened this issue Oct 7, 2019 · 3 comments

Comments

@Honeylemonade
Copy link

题目说把绳子剪成m段,每段绳子长度记为k[0],k[1],k[2]...k[m]。但是,从0~m共有m+1段

@AnnaWang288
Copy link

对的,还有动态规划的代码也有问题,lenght为3时输出是3还是2

@L-Xu-L
Copy link

L-Xu-L commented Feb 28, 2020

对的,还有动态规划的代码也有问题,lenght为3时输出是3还是2

lenght为3输出的是2 这里的lenght是指绳子的长度,由于题目要求至少得剪一刀,所以输出的是2 。 至于代码下面的products[3] = 3 是指 若绳子大于3 ,把该绳子剪成n段,若其中一段为3 ,则这段的最优解为3(不需要再剪一段)

@gyzcool
Copy link

gyzcool commented Jan 20, 2021

题目说把绳子剪成m段,每段绳子长度记为k[0],k[1],k[2]...k[m]。但是,从0~m共有m+1段

是的,我查了下leetcode 里的 剪绳子 问题 那里面改为了 k[0],k[1],k[2]....k[m-1]。

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

4 participants