A code editor lets you jump to a class by typing a short pattern. A class name from queries matches
when it can be produced by inserting lowercase letters into pattern (as many as you like,
anywhere, possibly none). Capital letters can never be inserted, so every capital in the name has to
come from the pattern.
Return a list of booleans, one per name in queries.
Examples
Input: queries = ["ReadMe", "RunMode", "RedMoonEvent", "Rm", "RemoteMount"], pattern = "RM"
Output: [True, True, False, False, True]
Input: queries = ["ReadMe", "RunMode", "RedMoonEvent", "Rm", "RemoteMount"], pattern = "RuM"
Output: [False, True, False, False, False]
Explanation: the lowercase "u" of the pattern must appear before the M, so only "RunMode" still matches.
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