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

文章中有一处代码有缺陷 #41

Open
sh1luo opened this issue May 6, 2021 · 0 comments
Open

文章中有一处代码有缺陷 #41

sh1luo opened this issue May 6, 2021 · 0 comments

Comments

@sh1luo
Copy link

sh1luo commented May 6, 2021

文件地址:algorithm-pattern/introduction/quickstart.md

问题strStr,问题代码:

func strStr(haystack string, needle string) int {
    if len(needle) == 0 {
        return 0
    }
    ....
}

如果子串长度为0的话返回0有歧义,误认为子串起始地址为0,我觉得改为负数之类的更好。

gitbook-com bot pushed a commit to zhangzz2015/algorithm-pattern that referenced this issue Jan 11, 2022
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