792. Number of Matching Subsequences
Practice Number of Matching Subsequences for free on NudgeCode: Medium, Binary Search pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
Return how many strings in words are subsequences of s. A subsequence is obtained by deleting some (possibly no) characters without changing the order of the rest. Repeated words are counted each time.
Example
s = "abcde", words = ["a","bb","acd","ace"] -> 3
s = "dsahjpjauf", words = ["ahjpjau","ja","ahbwzgqnuk","tnmlanowax"] -> 2
Constraints
- 1 <= s.length <= 5 * 10^4
- 1 <= words.length <= 5000, 1 <= words[i].length <= 50
- s and words[i] consist of lowercase English letters