Leetcode28
1.问题描述
2.解决方案
解法一:库函数
class Solution {
public:
int strStr(string haystack, string needle) {
return haystack.find(needle);
}
};
Java版本
class Solution {
public int strStr(String haystack, String needle) {
return haystack.indexOf(needle);
}
}
解法二:KMP
https://programmercarl.com/0028.%E5%AE%9E%E7%8E%B0strStr.html#其他语言版本