Tap here to switch tabs
Problem
Submissions

Problem: Find the Occurrence of First Almost Equal Substring

med
30 min
Try to solve the Find the Occurrence of First Almost Equal Substring problem.

Statement

You are given two strings s and pattern.

A substring of s is considered almost equal to pattern if it has the same length as pattern and differs from pattern in at most 11 character.

Return the minimum starting index of a substring in s that is almost equal to pattern. If no such substring exists, return −1-1.

Constraints:

  • 1≤1 \leq pattern.length << s.length ≤105\leq 10^5

  • s and pattern consist only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Occurrence of First Almost Equal Substring

med
30 min
Try to solve the Find the Occurrence of First Almost Equal Substring problem.

Statement

You are given two strings s and pattern.

A substring of s is considered almost equal to pattern if it has the same length as pattern and differs from pattern in at most 11 character.

Return the minimum starting index of a substring in s that is almost equal to pattern. If no such substring exists, return −1-1.

Constraints:

  • 1≤1 \leq pattern.length << s.length ≤105\leq 10^5

  • s and pattern consist only of lowercase English letters.