Practice Number of Matching Subsequences
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Medium#792
LeetCode ProblemNumber of Matching Subsequences
Problem Statement
Given a string s and an array of strings words, return the number of words[i] that is a subsequence of s. A subsequence of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.
Source: Number of Matching Subsequences on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
s = "abcde", words = ["a","bb","acd","ace"]
Output
3
# Example 2
Input
s = "dsahjpjauf", words = ["ahjpjau","ja","ahbwzgqnuk","tnmlanowax"]
Output
2
Constraints
1 <= s.length <= 5 * 10^4
1 <= words.length <= 5000
1 <= words[i].length <= 50
s and words[i] consist of only lowercase English letters.
Related LeetCode Problems
Practice more problems similar to Number of Matching Subsequences.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.