Implement regular expression matching with support for
'.' and
'*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
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", "a*") ? true
isMatch("aa", ".*") ? true
isMatch("ab", ".*") ? true
isMatch("aab", "c*a*b") ? true
[Thoughts]
与Wildcard Maching同一题。
http://codingtmd.azurewebsites.net/leetcode-wildcard-matching-solution/
本文探讨了如何实现支持 '.' 和 '*' 的正则表达式匹配问题。'.' 可匹配任意单个字符,'*' 则可以匹配其前导元素的零次或多次出现。文章提供了几个示例来说明如何使用该函数进行匹配,并指出该问题与通配符匹配问题类似。
3065

被折叠的 条评论
为什么被折叠?



