力扣精选top面试题-------- 实现 strStr()
思路:这道题就用双指针来做,这是比较简单的做法,还有一种就是KMP的做法代码:class Solution {public: int strStr(string haystack, string needle) { if ( needle == "" ) //空则返回0 return 0; int hlen = haystack.length(); int nlen = needle.length(