CT043

Regex Pattern Match

HardAcceptance: 0.0%

Implement regular expression matching with special characters: . (period) matches any single character, * (asterisk) matches zero or more of the preceding element. Given a string and a valid regex pattern, return whether the string matches. Output "true" or "false".

Example 1:

Input: ray ra.
Output: true

Example 2:

Input: chat .*at
Output: true

Constraints:

1 <= len(string) <= 100 1 <= len(pattern) <= 100 Pattern is valid (no leading *, no **)

Tags:

recursion dynamic-programming strings
Loading...
Test Cases:No test cases
No test cases available.