From 30e48785a83fd326c264b5303adba5158c499bc2 Mon Sep 17 00:00:00 2001 From: Kiril Kovachev Date: Fri, 8 Mar 2024 17:27:52 +0000 Subject: [PATCH] Add comment to 28. Find the Index of the First Occurrence in a String --- python/28_find_the_index_of_the_first_occurrence_in_a_string | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/28_find_the_index_of_the_first_occurrence_in_a_string b/python/28_find_the_index_of_the_first_occurrence_in_a_string index d843ed9..987cefa 100644 --- a/python/28_find_the_index_of_the_first_occurrence_in_a_string +++ b/python/28_find_the_index_of_the_first_occurrence_in_a_string @@ -1,3 +1,5 @@ +# Also consider using the KMP algorithm for better asymptotic performance (O(n+m) vs O(nm)). + class Solution: def strStr(self, haystack: str, needle: str) -> int: for i in range(len(haystack)):