LeetCode10. Regular Expression Matching翻譯

10. Regular Expression Matching

正則匹配

本題來自LeetCode OJ


題目翻譯

Implement regular expression matching with support for '.' and '*'.
實現正則表達式匹配,支持'.''*'

'.' Matches any single character.
'.' 匹配任何單個字符。
'*' Matches zero or more of the preceding element.
'*' 匹配0個或多個前面的元素

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章