目录 一、题目二、代码三、运行结果 一、题目 二、代码 class Solution { public: int strStr(string haystack, string needle) { int return_num; //第一种方法:库函数 return_num = haystack.find(needle); //第二种方法:KMP 可以先留着 return return_num; } }; 三、运行结果