Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- vector<bool> camelMatch(vector<string>& queries, string pattern) {
- vector<bool> res;
- for (string &query : queries) res.push_back(isMatch(query, pattern));
- return res;
- }
- bool isMatch(string query, string pattern) {
- int i = 0;
- for(char & c : query)
- if(i < pattern.length() && c == pattern[i]) i++;
- else if (c < 'a') return false;
- return i == pattern.length();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement