Skip to content

最长公共前缀题目数组检测函数修复#410

Merged
Snailclimb merged 3 commits intoSnailclimb:masterfrom
keepal7:master
Jul 25, 2019
Merged

最长公共前缀题目数组检测函数修复#410
Snailclimb merged 3 commits intoSnailclimb:masterfrom
keepal7:master

Conversation

@keepal7
Copy link
Copy Markdown
Contributor

@keepal7 keepal7 commented Jul 25, 2019

原文中的校验,存在边界问题,当 String[] strs = {};或者 String[] strs = null;时仍然会报错。

keepal7 added 2 commits July 25, 2019 10:12
原文中的校验,存在边界问题,当 String[] strs = {};或者 String[] strs = null;时仍然会报错。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果中间某一个字符串为空串,前面和后面的字符串都不为空串,那你这里就返回true了,不符合题意吧

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

的确,有欠考虑。多谢指出~不过原文里面的检查函数的确有两个情况下会出问题,我再改下

原文中的校验,存在边界问题,当 String[] strs = {};或者 String[] strs = null;时仍然会报错。
@Snailclimb Snailclimb merged commit bb4630c into Snailclimb:master Jul 25, 2019
@Snailclimb Snailclimb added the perfect Improve knowledge points or descriptions label Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perfect Improve knowledge points or descriptions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants