Tap here to switch tabs
Problem
Submissions

Problem: Length of the Longest Valid Substring

med
30 min
Try to solve the Length of the Longest Valid Substring problem.

Statement

You are given a string word and an array of strings forbidden.

A substring of word is called valid if none of the strings present in forbidden appear as a substring within it.

Return the length of the longest valid substring of word.

Constraints:

  • 1≤1 \leq word.length ≤105\leq 10^5

  • word consists only of lowercase English letters.

  • 1≤1 \leq forbidden.length ≤105\leq 10^5

  • 1≤1 \leq forbidden[i].length ≤10\leq 10

  • forbidden[i] consists only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Length of the Longest Valid Substring

med
30 min
Try to solve the Length of the Longest Valid Substring problem.

Statement

You are given a string word and an array of strings forbidden.

A substring of word is called valid if none of the strings present in forbidden appear as a substring within it.

Return the length of the longest valid substring of word.

Constraints:

  • 1≤1 \leq word.length ≤105\leq 10^5

  • word consists only of lowercase English letters.

  • 1≤1 \leq forbidden.length ≤105\leq 10^5

  • 1≤1 \leq forbidden[i].length ≤10\leq 10

  • forbidden[i] consists only of lowercase English letters.