-
Notifications
You must be signed in to change notification settings - Fork 0
/
1023. 驼峰式匹配.cpp
33 lines (31 loc) · 898 Bytes
/
1023. 驼峰式匹配.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class Solution {
public:
vector<bool> camelMatch(vector<string>& queries, string pattern) {
int j=0;
vector<bool>ans;
while(j<queries.size()){
string match=queries[j];
int k=0,l=0;
bool find=false;
while(k<pattern.length() && l<match.length()){
if(pattern[k]==match[l]) l++,k++;
else if(isupper(match[l])){
find=true;
break;
}else{
l++;
}
}
while(l<match.length()){
if(isupper(match[l++])) {
find=true;
break;
}
}
if(k==pattern.length() && !find) ans.push_back(1);
else ans.push_back(0);
j++;
}
return ans;
}
};