leetcode - Wildcard Matching
来源:互联网 发布:阿里云客服报名 编辑:程序博客网 时间:2024/05/16 05:39
Implement wildcard pattern matching with support for '?'
and '*'
.
'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).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") → falseisMatch("aa","aa") → trueisMatch("aaa","aa") → falseisMatch("aa", "*") → trueisMatch("aa", "a*") → trueisMatch("ab", "?*") → trueisMatch("aab", "c*a*b") → false
class Solution {public: bool isMatch(const char *s, const char *p) { const char* star=NULL; const char* t=s; while (*s){ if ((*p=='?')||(*p==*s)){s++;p++;continue;} if (*p=='*'){star=p++; t=s;continue;} if (star){ p = star+1; s=++t;continue;} return false; } while (*p == '*'){p++;} return !*p; }};
0 0
- LeetCode: Wildcard Matching
- LeetCode : Wildcard Matching
- [LeetCode] Wildcard Matching - Iteratively
- leetcode 83: Wildcard Matching
- [Leetcode] Wildcard Matching
- [LeetCode]Wildcard Matching
- LeetCode-Wildcard Matching
- LeetCode -- Wildcard Matching
- LeetCode | Wildcard Matching
- Leetcode: Wildcard Matching
- Leetcode:Wildcard Matching
- LeetCode题解:Wildcard Matching
- LeetCode Wildcard Matching
- [Leetcode] Wildcard Matching (Java)
- LeetCode OJ:Wildcard Matching
- Leetcode: Wildcard Matching
- Wildcard Matching -- LeetCode
- [LeetCode] Wildcard Matching
- JNI学习积累之二 ---- 数据类型映射、域描述符说明
- python系统默认编码
- JNI学习积累之三 ---- 操作JNI函数以及复杂对象传递
- Yii Framework2.0开发教程(5)数据库mysql函数
- 结构体内存对齐
- leetcode - Wildcard Matching
- 安卓实现自定义的主题
- hdu1596——find the safest road
- linux ls命令使用
- Java基础笔记-第三记
- u盘安装Ubuntu12.04
- hdu 5083Instruction(模拟大法好)
- 获取View视图的Bitmap
- 水仙花数的另外一种解法