A query string matches a pattern if you can insert lowercase letters (any number, at any positions,
possibly none) into pattern to obtain the query. Uppercase letters can never be inserted, so every
uppercase letter of the query must come from the pattern.
Given queries and pattern, return a list of booleans, one per query.
Examples
Input: queries = ["FooBar", "FooBarTest", "FootBall", "FrameBuffer", "ForceFeedBack"], pattern = "FB"
Output: [True, False, True, True, False]
Input: queries = ["FooBar", "FooBarTest", "FootBall", "FrameBuffer", "ForceFeedBack"], pattern = "FoBa"
Output: [True, False, True, False, False]
Constraints
0 <= len(queries) <= 5000, each query of length<= 100;0 <= len(pattern) <= 100- Queries and the pattern consist of English letters only
- Target:
O(len(query))per query
Goals
- Match a pattern as a subsequence while enforcing a rule on skipped characters
- Return per-query results for many queries