ALG-H015HardDynamic Programming
Wildcard Filename Rule
Return whether pattern matches the entire text. ? matches any one character; * matches any sequence including empty; other characters match themselves.
Contract
input text: string
input pattern: string
return boolean
Constraints
- • 0 <= lengths <= 1000
Examples
Example 1
text = "adceb"
pattern = "*a*b"
→ true
Example 2
text = "acdcb"
pattern = "a*c?b"
→ false
5 judge tests (2 shown above). Target complexity: O(text_length * pattern_length).