Easy C++ Solution || Hashmaps + BinarySearch ✔✔
Brute Force : TLE\n\nclass Solution {\npublic:\n    map<string,int> mp;\n    bool isSub(string s, string test){\n        int j=0;\n        for (int i=0; i<test.
## Brute Force : TLE\n```\nclass Solution {\npublic:\n    map<string,int> mp;\n    bool isSub(string s, string test){\n        int j=0;\n        for (int i=0; i<test.size(); i++){\n            while (j<s.size() && s[j]!=test[i]){ j++;}\n            if (j>=s.size())return 0;\n            j++;\n        }\n        return 1;\n    }\n    int numMatchingSubseq(string s, vector<string>& words) {\n        int cnt=0;\n        for (int i=0; i<words.size(); i++){\n            if (isSub(s,words[i])){\n                cout<<words[i]<<endl;\n                cnt++;\n            }\n        }\n        return cnt;\n    }\n};\n```\n\n\n\n## Hashmaps + BinarySearch \n```\n\nclass Solution {\npublic:\n    int numMatchingSubseq(string s, vector<string>& words) {\n        map<char,vector<int>> mp;\n        int cnt=0;\n        for (int i=0; i<s.size();i++){\n            mp[s[i]].push_back(i);\n        }\n        for (int i=0; i<words.size(); i++){\n            string word= words[i];\n            int curr=-1; bool flg=1;\n            for (int j=0; j<word.size(); j++){\n                char ch= word[j];\n                if (mp.find(ch)==mp.end()){flg=0;break;}\n                if(upper_bound(mp[ch].begin(),mp[ch].end(),curr)==mp[ch].end()){flg=0;break;}\n                curr= mp[ch][upper_bound(mp[ch].begin(),mp[ch].end(),curr)-mp[ch].begin()];\n            }\n            if (flg)cnt++;\n        }\n        return cnt;\n    }\n};\n\n```
['Hash Table', 'Two Pointers', 'String', 'Binary Search', 'C++']