From 9558af957bd2077773a11fb4ebae7e432838c08a Mon Sep 17 00:00:00 2001 From: Charlie <1753524606@qq.com> Date: Sun, 23 Apr 2023 14:55:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=200028.=E5=AE=9E=E7=8E=B0str?= =?UTF-8?q?Str=20Rust=E7=89=88=E6=9C=AC=E5=A4=9A=E4=BD=99=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0028.实现strStr.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/problems/0028.实现strStr.md b/problems/0028.实现strStr.md index 263c1689..2a81db88 100644 --- a/problems/0028.实现strStr.md +++ b/problems/0028.实现strStr.md @@ -1314,7 +1314,6 @@ impl Solution { pub fn str_str(haystack: String, needle: String) -> i32 { let (haystack_len, needle_len) = (haystack.len(), needle.len()); - if haystack_len == 0 { return 0; } if haystack_len < needle_len { return -1;} let (haystack, needle) = (haystack.chars().collect::>(), needle.chars().collect::>()); let mut next: Vec = vec![0; haystack_len]; @@ -1355,9 +1354,6 @@ impl Solution { next } pub fn str_str(haystack: String, needle: String) -> i32 { - if needle.is_empty() { - return 0; - } if haystack.len() < needle.len() { return -1; }