792. Number of Matching Subsequences
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.
- For example, “ace” is a subsequence of “abcde”.
- Time : O(m n log k)
- m is size of words
- n is length of word
- k is length of s
- Space : O(1) (constant)
1 | class Solution { |