题目摘要
完成函数strStr(String haystack, String needle)
,返回needle在haystack中第一次出现的位置,没有出现返回-1。
解法
双指针法
注意
原题
Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
题目摘要
完成函数strStr(String haystack, String needle)
,返回needle在haystack中第一次出现的位置,没有出现返回-1。
解法
双指针法
注意
原题
Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.