Pattern matching with mismatches
Your task
Given a text string and a shorter pattern string (both lowercase), find every starting index in the text where the pattern matches with at most k character mismatches (Hamming distance <= k over the window). Return the list of matching start indices in increasing order. The text length is up to a few thousand characters and 0 <= k <= len(pattern).
Examples
fuzzy_match(text: str, pattern: str, k: int) -> list[int]Example 1
Input
fuzzy_match("abcde", "axc", 1)Output
[0]