Implement strStr().

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

题目大意:实现一个子串查找函数

 

题目链接:https://leetcode.com/problems/implement-strstr/description/

 

这个查找方法,除了最简单的,应该就Kmp比较出名了。

这里没办法讲这个题,主要就是Kmp算法的应用。

C++代码如下:

 

大致如此。

【LeetCode】28. Implement strStr()
Tagged on:     
0 0 投票数
Article Rating
订阅评论
提醒

0 评论
内联反馈
查看所有评论