This repository contains a solution for the regular expression matching problem, which checks if an input string s
matches a given pattern p
that supports the special characters .
and *
.
Implement regular expression matching with support for:
.
: Matches any single character.*
: Matches zero or more of the preceding element.The matching should cover the entire input string (not partial).
Example 1:
s = "aa"
, p = "a"
false
Example 2:
s = "aa"
, p = "a*"
true
'*'
means zero or more of the preceding element, 'a'
. Therefore, by repeating 'a'
once, it becomes "aa".Example 3:
s = "ab"
, p = ".*"
true
) of any character (
.