forked from rost0413/LeetCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Wildcard_Matching.cpp
48 lines (41 loc) · 1.1 KB
/
Wildcard_Matching.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
Author: Weixian Zhou, ideazwx@gmail.com
Date: Jul 28, 2012
Problem: Wildcard Matching
Difficulty:
Source: http://www.leetcode.com/onlinejudge
Notes:
Implement wildcard pattern matching with support for '?' and '*'.
'?' Matches any single character.
'*' Matches any sequence of characters (including the empty sequence).
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, const char *p)
Some examples:
isMatch("aa","a") → false
isMatch("aa","aa") → true
isMatch("aaa","aa") → false
isMatch("aa", "*") → true
isMatch("aa", "a*") → true
isMatch("ab", "?*") → true
isMatch("aab", "c*a*b") → false
Solution:
This problem is same with Regular Expression Matching.
*/
#include <vector>
#include <set>
#include <climits>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstring>
using namespace std;
class Solution {
public:
bool isMatch(const char *s, const char *p) {
/*
* Same with Regular Expression Matching.
*/
}
};