nikunjsoni

1023

Jun 26th, 2021
96
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Solution {
  2. public:
  3.     vector<bool> camelMatch(vector<string>& queries, string pattern) {
  4.         vector<bool> res;
  5.         for (string &query : queries) res.push_back(isMatch(query, pattern));
  6.         return res;
  7.  
  8.     }
  9.  
  10.     bool isMatch(string query, string pattern) {
  11.         int i = 0;
  12.         for(char & c : query)
  13.             if(i < pattern.length() && c == pattern[i]) i++;
  14.             else if (c < 'a') return false;
  15.         return i == pattern.length();
  16.     }
  17. };
RAW Paste Data