28. Implement strStr()

来源:互联网 发布:svg获取坐标 path.js 编辑:程序博客网 时间:2024/04/28 08:56

题目摘要
完成函数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.

0 0
原创粉丝点击