leetcode Wildcard Matching

class Solution {
public:
    bool isMatch(const char *s, const char *p) {
        // Start typing your C/C++ solution below
        // DO NOT write int main() function
        if (*p == '*'){//return true;
            while(*p == '*') ++p;
            if (*p == '') return true;
            while(*s != '' && !isMatch(s,p)){
                ++s;                
            }
            return *s != '';
        }
        else if (*p == '' || *s == '') return *p == *s;
        else if (*p == *s || *p == '?') return isMatch(++s,++p);
        else return false;
    }
};

  

原文地址:https://www.cnblogs.com/tgkx1054/p/3152364.html