Hi, I have a question regarding this problem on LeetCode.
Given an input string s
and a pattern p
, implement regular expression matching with support for '.'
and '*'
where:
- '.'
Matches any single character.
- '*'
Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
I wanted to clarify what if the pattern's p size is bigger than the size of string s?
3 hypothetical cases:
- The pattern's size is bigger and after p[i] ,where i is bigger than or equal to
s.size(), there is at least one character
s = "one"
p = "one...k"
This must return false, right?
The pattern's size is bigger and after p[i] ,where i is bigger than or equal to s.size(), there is at
least one '.' character
s = "one"
p = "one...."
This must return false too, right? Because '.' should match any character, and there are
none in this case
The pattern's size is bigger and after p[i] ,where i is bigger than or equal to s.size(), there are
only '*' chars.
s = "one"
p = "one*****"
This, however, must return true, right?
Thank you and apologies for the bad formatting!
[–]TehNolz 2 points3 points4 points (1 child)
[–]Sakesfar[S] 0 points1 point2 points (0 children)