【Leetcode】之Regular Expression Matching

来源:互联网 发布:mac 10.11.6 官方下载 编辑:程序博客网 时间:2024/06/01 11:26

问题描述:
mplement 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

我的解题思路:
这套题没做出来,关于*目前还是不够理解。
参考资料:http://blog.csdn.net/doc_sgl/article/details/12719761

0 0
原创粉丝点击