字符串匹配的算法总结

一、KMP模板 实现: 主要需要完成next数组决字符串的匹配。 返回的是needle字符串首次匹配 haystack字符串的首字符的下标(下标是针对haystack字符串的)。 模板: 1 int strStr(string haystack, string needle) { 2 int n =
posted @ 2021-12-24 20:49  白雪儿  Views(25)  Comments(0Edit  收藏  举报