diff options
| author | Mistivia <i@mistivia.com> | 2025-09-06 23:17:22 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-09-06 23:17:41 +0800 |
| commit | ad95cba8220e2a7c86362caeb76e1a4333e9c2b8 (patch) | |
| tree | 30b31d94e2ceb46d4e946bfa1eb88b956508f760 /rust/src/bin/p0028.rs | |
| parent | 5dd8dcdc2ccfa89d25a3cb342a2f89c644236971 (diff) | |
refactor
Diffstat (limited to 'rust/src/bin/p0028.rs')
| -rw-r--r-- | rust/src/bin/p0028.rs | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/rust/src/bin/p0028.rs b/rust/src/bin/p0028.rs deleted file mode 100644 index c830ac4..0000000 --- a/rust/src/bin/p0028.rs +++ /dev/null @@ -1,20 +0,0 @@ -impl Solution { - pub fn str_str(haystack: String, needle: String) -> i32 { - if needle.len() > haystack.len() { return -1; } - for i in 0..haystack.len() - needle.len()+1 { - let mut failed = false; - for j in 0..needle.len() { - if haystack.as_bytes()[i+j] != needle.as_bytes()[j] { - failed = true; - break; - } - } - if !failed { return i as i32; } - } - -1 - } -} -struct Solution { } -fn main() { - println!("{}", Solution::str_str("abaaa".to_string(), "abb".to_string())); -}
\ No newline at end of file |
