Wildcard Matching
来源:互联网 发布:美工使用的软件 编辑:程序博客网 时间:2024/06/03 23:52
迭代:
#include<iostream>using namespace std;class Solution{public: bool isMatch(const char *s, const char *p) { int i=0,j=0; bool str=false; for(;s[i]!='\0';i++,j++) { switch (p[j]) { case '?': break; case '*': while(p[j]=='*') j++; if(p[j]=='\0') return true; str=true; i--; j--; break; default: if(s[i]!=p[j]) { if(!str) return false; else j--; break; } } } while(p[j++]=='*'); return p[j]=='\0'; }};void main(){ Solution solution; cout<<solution.isMatch("aab","*a*b");}
0 0
- Wildcard Matching
- Wildcard Matching
- Wildcard Matching
- Wildcard Matching
- Wildcard Matching
- Wildcard Matching
- Wildcard Matching
- Wildcard Matching
- Wildcard Matching
- Wildcard Matching
- Wildcard Matching
- Wildcard Matching
- Wildcard matching
- Wildcard Matching
- Wildcard Matching
- Wildcard Matching
- Wildcard Matching
- Wildcard Matching
- 自己练习写的Procedure,两种方法遍历cursor,代码已验证
- C++实现设计模式之 —— 单例模式 Singleton
- 密码学基础知识(六)Hash函数与消息认证
- Binary Search Tree Iterator
- Qt读取ini配置文件
- Wildcard Matching
- 第4章 更多的 bash shell命令 - df、du、sort、grep、zip、tar等
- 针对TCP连接异常断开的分析
- leetCode 27.Remove Element (删除元素) 解题思路和方法
- JAWR【一个java项目的javascript和CSS集成和压缩工具】
- MYSQY数据库类型与Java类型的对比图(收藏使用)
- 用成员运算符重载函数进行复数运算
- winsock基础编程
- 2015年7月7日