Medium · Strings

Number of Matching Subsequences

Given an ASCII string s and an array of non-empty ASCII words, return how many of the words are subsequences of s, counting duplicate words separately.

Examples

Example 1

s="abcde", words=[a,bb,acd,ace]

Output: 3 matching

Example 2

s="dsahjpjauf", words=[ahjpjau,ja,ahbwzgqnuk,tnmlanowax]

Output: 2 matching

Rebuild it in the studio

Core interview problems are free with a full runner and lessons; Pro opens the complete library.

More Strings problems