实现strStr():实现 strStr() 函数。 给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始)。如果不存在,则返回 -1。 思路:思路比较简单,暴力法。程序:class Solution:def strStr(self, haystack: str, ne
The strstr() function finds the first occurrence of the substring needle in the string haystack. The terminating '\0' characters are not compared. */ char *strstr_r(char *s1, char *s2) { /* s1 : hellwoleddlfjwo, s2: wol */ const char *p1, *p2; if((*s2) == '\0') /* E...