摘要:
字符串匹配,由于*可以匹配任意的一串字符,必须遍历所有可能的匹配情况,所以这里用迭代比递归要更好一点,遇到*之后,假定*匹配0个字符,一直到匹配整个s字符,遍历判断是否可以匹配成功;用指针prep记录*后面一个非*字符,用pres来记录遍历的起始点; 1 class Solution { 2 public: 3 bool isMatch(const char *s, const char *p) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() funct... 阅读全文
posted @ 2013-09-19 15:21
Exio
阅读(342)
评论(0)
推荐(0)