Skip to content

Instantly share code, notes, and snippets.

@Seniru
Created May 28, 2025 08:41
Show Gist options
  • Select an option

  • Save Seniru/f51c7cefe58550ff611ccc3adf5f7414 to your computer and use it in GitHub Desktop.

Select an option

Save Seniru/f51c7cefe58550ff611ccc3adf5f7414 to your computer and use it in GitHub Desktop.
def naive_string_matcher(string, pattern):
string_len = len(string)
pattern_len = len(pattern)
for i in range(len(string)):
if string[i:i+pattern_len] == pattern:
return i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment