Skip to content

Latest commit

 

History

History

28-Implement-strStr()

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

28. Implement strStr()

Implement strStr().

Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

题意

让你实现strStr函数,在一个字符串中找另一个字符串,能找到就返回第一个匹配的位置,不能就返回-1

方法(一)

two pointer