Count Substrings Similar to a Keyword
Asked at Amazon · Coding Questions · Difficulty: Medium
A string is *similar* to `key` if it equals `key` or can be made equal by swapping two adjacent characters at most once. Count the substrings of `text` (of length `len(key)`) that are similar to `key`.
Loading the problem…