In the problem example case:
isMatch("ab", ".*") → true
while the Input ("ab", ".*c") Expected output is false??
Here is another one. How come isMatch("c", "cab") and isMatch("a", "cab") returns false? It's expected true, right?
However, isMatch("b", "cab") does return true!
I think the key is how to understand "match". I'm confused at the beginning,too. After seeing the discussion ,I find out that "match" seems to mean "equal" in this problem. So ".*" =".."="ab". But ".*c" must contain 'c', but "ab" does not contain 'c'.
@huster But this also says true:
S doesn't contain "c"
@jimjea 'cab' = 'a*b'= 'aab'
@jimjea c* can match any amount of c, here it can match zero c,
then a* matches two a(s), this is why cab can match aab
so in the case [isMatch("ab", ".") → true] which is defined as a example of this problem, the dot match the 'a', then the star means 'Matches zero or more of the preceding element.', i don't know which character in '.' can match 'b'.
...I can not understand, I think this problem has a bug...
@JayFang1993 I'm confused by this problem too. And I think that the second string contains the first string is true but the result is false...
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.