【LeetCode】10. Regular Expression Matching

来源:互联网 发布:13年最火的网络歌曲 编辑:程序博客网 时间:2024/06/06 05:51

LeetCode10. Regular Expression Matching

 

【问题描述】

  Implement regular expression matching with support for '.' and '*'.

'.' Matches anysingle character.

'*' Matches zero ormore of the preceding element.

 

The matching shouldcover theentire input string (not partial).

 

The functionprototype should be:

bool isMatch(constchar *s, const char *p)

 

【输入输出】

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

 

【解题思路】



 

【代码】

 

0 0
原创粉丝点击