From 91b35df8d03484cf80234249657a1f5be1e08221 Mon Sep 17 00:00:00 2001 From: chenshuai <2268380485@qq.com> Date: Sat, 12 Apr 2025 22:07:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=80=A7=E6=8F=90=E4=BA=A4:?= =?UTF-8?q?=E4=BF=AE=E6=94=B9(=E6=B7=BB=E5=8A=A04=E8=A1=8C)=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E5=AD=98=E5=9C=A8=E7=9A=84=E6=B5=8B=E8=AF=95=E6=80=A7?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/other/temp.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/other/temp.js b/src/other/temp.js index ed3c9ed..dae047a 100644 --- a/src/other/temp.js +++ b/src/other/temp.js @@ -15,4 +15,8 @@ function kmpSearch(str, pattern) { } } + if (j === pattern.length) { + return i - j; + } + return -1; } \ No newline at end of file