class Solution {
public:
bool isMatch(const char *s, const char *p) {
char *ss = NULL, *sp = NULL;
while(*s){
if(*p=='?'||*s==*p){s++;p++;continue;}
if(*p=='*'){ss=const_cast<char*>(s);sp=const_cast<char*>(++p);continue;}
if(ss){s=++ss;p=sp;continue;}
return false;
}
while(*p=='*'){
p++;
}
return !*p;
}
};
Leetcode Wildcard Matching
最新推荐文章于 2019-07-07 13:48:32 发布