Input: "ab", ".*c"
Why? I think ".*" means "........"(unlimited number) which can include any string.
And in the example ——isMatch("ab", ".*") → true
I was very confused.
while, you need look at this example given in the subject.
isMatch("aab", "c*a*b") → true.
It means in the algorithm " isMatch(string s, string p)", p can include char which doesn't appear in s. Based on your comment, maybe the truth is if matching successed, p should end ???
for c* in the example isMatch("aab", "c*a*b") → true, * matches zero or more of the preceding element, but c still exist. So it equals to isMatch("aab", "ca*b") → true? Thanks!
No. '*' Matches zero or more of the preceding element. Note "proceeding" which needs be adjacent.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.