Regular Expression Matching
来源:互联网 发布:英国读研要求gpa算法 编辑:程序博客网 时间:2024/05/22 05:10
题目地址:点击打开链接
class Solution {public: bool isMatch(string s, string p) { return match(s,p,0,0); }private: bool match(string s,string p,int a,int b) { int m=s.size(); int n=p.size(); if(a==m&&b==n)return true; if(b==n)return false; if(b==n-1||p[b+1]!='*'){ if(a<m&&(s[a]==p[b]||p[b]=='.'))return match(s,p,a+1,b+1); return false; }else{ if(match(s,p,a,b+2))return true; while(a<m&&(s[a]==p[b]||p[b]=='.')){ if(match(s,p,a+1,b+2))return true; ++a; } return false; } }};
0 0
- LeetCode: Regular Expression Matching
- LeetCode: Regular Expression Matching
- leetcode Regular Expression Matching
- [Leetcode] Regular Expression Matching
- Regular Expression Matching
- Regular Expression Matching
- [LeetCode]Regular Expression Matching
- Regular Expression Matching
- LeetCode-Regular Expression Matching
- Regular Expression Matching
- 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
- swift2 构造过程
- best cow line(poj3617)
- android5.0使用svg
- 集合划分
- JavaScript第一阶段总结
- Regular Expression Matching
- 颜色工具
- Android 面试题
- java存储GBK编码数据到redis
- hdu 1074 Doing Homework 状压dp
- iOS初学者第四天
- UVA 1587 BOX
- 控件布局
- python读取配置文件