LeetCode: Regular Expression Matching
来源:互联网 发布:淘宝热卖怎么参加 编辑:程序博客网 时间:2024/04/27 21:25
似乎“.*”能匹配任意的字符串,如“abcd”
class Solution {
public:bool isMatch(const char *s, const char *p) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(*p=='\0')
return *s=='\0';
if(*(p+1)!='*')
return (*s==*p||(*p=='.'&&*s!='\0'))&&isMatch(s+1,p+1);
while(*s==*p||(*p=='.'&&*s!='\0')){
if(isMatch(s,p+2))
return true;
s++;
}
return isMatch(s,p+2);
}
};
- LeetCode: Regular Expression Matching
- LeetCode: Regular Expression Matching
- leetcode Regular Expression Matching
- [Leetcode] Regular Expression Matching
- [LeetCode]Regular Expression Matching
- LeetCode-Regular Expression Matching
- Regular Expression Matching LeetCode
- LeetCode | Regular Expression Matching
- LeetCode: Regular Expression Matching
- Leetcode: Regular Expression Matching
- [LeetCode] Regular Expression matching
- [LeetCode] Regular Expression Matching
- LeetCode Regular Expression Matching
- leetcode Regular Expression Matching
- leetcode: Regular Expression Matching
- LeetCode Regular Expression Matching
- Leetcode: Regular Expression Matching
- leetcode:Regular Expression Matching
- websphere如何打开详细垃圾回收的开关?
- pig Disambiguate Operator
- 实现MySQL定时执行并不难!
- Ubuntu 10.04 64位git源码编译安装
- 数据库JDBC驱动
- LeetCode: Regular Expression Matching
- 在C#中创建类型
- 转: 数据结构——查找
- MyEclipse 集成tomcat 报Value must be an existing directory错误。
- 统计Xcode代码行数的简便方法
- UML类图几种关系的总结
- iOS自己制作Framwork
- 遍历Window内所有子控件方法
- CNZZ统计发现超级弹窗,弹出窗口超过10个,弹窗问题解决办法