leetcode28--------------Implement strStr()
讲道理的话,还是用KMP,但是偷懒用了string的find方法
KMP模式匹配早已年久失修,等过段时间复习一下KMP再过来补充。。。
先上一个比较水的代码吧。
class Solution {
public:
int strStr(string haystack, string needle) {
return haystack.find(needle);
}
};leetcode28--------------Implement strStr()
讲道理的话,还是用KMP,但是偷懒用了string的find方法
KMP模式匹配早已年久失修,等过段时间复习一下KMP再过来补充。。。
先上一个比较水的代码吧。
class Solution {
public:
int strStr(string haystack, string needle) {
return haystack.find(needle);
}
};
被折叠的 条评论
为什么被折叠?