44. Wildcard Matching
来源:互联网 发布:it行业 知乎 编辑:程序博客网 时间:2024/04/30 17:47
class Solution {public: bool isMatch(string s, string p) { int ppos=0; int spos=0; int star=-1;//找到的'*'的下标 int match; while(spos<s.size()) { if(ppos<p.size()&&(s[spos]==p[ppos]||p[ppos]=='?'))//当前字符匹配 { spos++; ppos++; } else if(ppos<p.size()&&p[ppos]=='*')//当前字符不匹配 当前p[ppos]=‘×’ { match=spos; star=ppos++; } else if(star>=0)//当前字符不匹配 当前p[ppos]!=‘×’ 前一个模式串是'*' { ppos=star+1; spos=++match; } else return false; } while(ppos<p.size()&&p[ppos]=='*') ppos++; return ppos==p.size(); }};
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
- Android Studio signed apk 引入so包
- Handler异步消息处理机制,从源代码看起
- [225] Implement Stack using Queues
- NSNotification多次执行的问题
- 1036. 跟奥巴马一起编程(15)-PAT乙级真题
- 44. Wildcard Matching
- (0001) iOS 开发之收集第三方资源篇
- AngularJS Scope(作用域)
- MPRemoteCommandCenter
- 1032. 挖掘机技术哪家强(20)-PAT乙级真题
- hashCode() 和equals() 区别和作用
- 37定律的分析和模拟(随机数组的生成算法)
- 杭电-1009 FatMouse' Trade
- android应用去掉标题栏的方法