Tap here to switch tabs
Problem
Submissions

Problem: Number of Matching Subsequences

med
30 min
Try to solve the Number of Matching Subsequences problem.

Statement

Given a string s and an array of strings words, return the number of strings in words that are subsequences of s.

A string is a subsequence of s if it can be formed by deleting zero or more characters from s without changing the relative order of the remaining characters.

Constraints:

  • 1≤1 \leq s.length ≤5∗104\leq 5 * 10^4

  • 1≤1 \leq words.length ≤5000\leq 5000

  • 1≤1 \leq words[i].length ≤50\leq 50

  • s and words[i] consist of only lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Matching Subsequences

med
30 min
Try to solve the Number of Matching Subsequences problem.

Statement

Given a string s and an array of strings words, return the number of strings in words that are subsequences of s.

A string is a subsequence of s if it can be formed by deleting zero or more characters from s without changing the relative order of the remaining characters.

Constraints:

  • 1≤1 \leq s.length ≤5∗104\leq 5 * 10^4

  • 1≤1 \leq words.length ≤5000\leq 5000

  • 1≤1 \leq words[i].length ≤50\leq 50

  • s and words[i] consist of only lowercase English letters.