Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Update (2014-11-02):
The signature of the function had been updated to return the index instead of the pointer. If you still see your function signature returns a char
* or String, please click the reload button to
reset your code definition.
{优快云:CODE:633753}

本文介绍如何实现strStr()函数,该函数用于查找一个字符串(needle)在另一个字符串(haystack)中首次出现的位置,并返回相应的索引。如果未找到,则返回-1。文章更新了函数签名以返回索引而非指针。
332

被折叠的 条评论
为什么被折叠?



