44. Wildcard Matching
来源:互联网 发布:黑客页面源码 编辑:程序博客网 时间:2024/06/07 23:42
'?' 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("aabool isMatch(string s, string p) { int Slen=s.length(),Plen=p.length(),i,j,iStart=-1,jStart=-1; for(i=0,j=0;i<Slen;++i,++j) { if(p[j]=='*') { iStart=i; jStart=j; --i; } else { if(p[j]!=s[i] && p[j]!='?') { if(iStart>=0) { i=iStart++; j=jStart; } else return false; } } } while(p[j]=='*') ++j; return j==Plen; }
阅读全文
0 0
- LeetCode --- 44. Wildcard Matching
- [Leetcode] 44. Wildcard Matching
- 44. Wildcard Matching
- Leetcode 44. Wildcard Matching
- 44. Wildcard Matching
- 44. Wildcard Matching
- leetcode 44. Wildcard Matching
- Leetcode 44. Wildcard Matching
- Leetcode:44. Wildcard Matching
- LeetCode 44. Wildcard Matching
- leetcode.44. Wildcard Matching
- LeetCode 44. Wildcard Matching
- Leetcode-44. Wildcard Matching
- 44. Wildcard Matching
- 44. Wildcard Matching
- [LeetCode] 44. Wildcard Matching
- 44. Wildcard Matching
- [leetcode] 44. Wildcard Matching
- 聊聊“速8”美女黑客控制僵尸车
- 阿里云生态日沙龙申请及落地规则
- 产品设计读书笔记
- 云栖Android精华文章合集
- iframe内容未知,高度可预测
- 44. Wildcard Matching
- caffe
- socket的accept函数解析以及服务器和多个客户端的端口问题
- 简单介绍java Enumeration
- Bootstrap table 简单示例
- K-Means聚类算法的实现
- JS Date()相关方法获取年月日时分秒
- javascript实现锁定网页、密码解锁效果(类似系统屏幕保护效果)
- 开源处理器Rocket的分支预测机制研究与性能评估(三)