A clearly problem, just compare the element when element-wise. When the needle pointer get the end, return it. If do not meet at the end, return -1. A stupid point is that the problem treat the needle empty as a valid size, and we can return 0. I think it is unclear and unreasonable.
leetcode-28-Implement strStr()
最新推荐文章于 2020-12-09 02:08:29 发布