diff options
Diffstat (limited to 'wildcard_matching.cpp')
-rw-r--r-- | wildcard_matching.cpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/wildcard_matching.cpp b/wildcard_matching.cpp deleted file mode 100644 index 23a6538..0000000 --- a/wildcard_matching.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - bool isMatch(string s, string p) { - int m = s.length(), n = p.length(); - int i = 0, j = 0, astr = -1, match; - while (i < m) { - if (j < n && p[j] == '*') - match = i, astr = j++; - else if (j < n && (s[i] == p[j] || p[j] == '?')) - i++, j++; - else if (astr >= 0) - i = ++match, j = astr + 1; - else - return false; - } - while (j < n && p[j] == '*') - j++; - return j == n; - } -}; - -int main() {} |