A file browser filters names with a pattern where ? matches exactly one character and * matches any sequence of characters (including the empty one). Every other character matches only itself. The pattern must match the whole name. Return True if name matches pattern.
Examples
Input: name = "report_v2.txt", pattern = "rep*.t?t"
Output: True
Input: name = "data.csv", pattern = "*.txt"
Output: False
Constraints
0 <= len(name), len(pattern) <= 300namecontains letters, digits,.and_;patternmay also contain?and*.- Naive backtracking over stars can take exponential time; aim for O(len(name) * len(pattern)).
Goals
- Build a boolean table matching prefixes of a name and a pattern
- Let a star absorb zero or more characters through two table neighbours