C++ || 90% faster || Easy Understanding || step by step Explanation ||binary search || hashmap
\n\n\t\tclass Solution {\n\t\tpublic:\n\t\t\tint numMatchingSubseq(string s, vector& words) {\n\t\t\t\tvector> v(26);\n\t\t\t\tfor(int i=0;i<s.length();i++){\n\
```\n```\n\t\tclass Solution {\n\t\tpublic:\n\t\t\tint numMatchingSubseq(string s, vector<string>& words) {\n\t\t\t\tvector<vector<int>> v(26);\n\t\t\t\tfor(int i=0;i<s.length();i++){\n\t\t\t\t\tv[s[i]-\'a\'].push_back(i);            // first make hash-map\n\n\t\t\t\t}\n\t\t\t\tint ans=0;\n\t\t\t\tfor(int i=0;i<words.size();i++){\n\t\t\t\t\tint last;                                             // last is used to store the index of last character\n\t\t\t\t\tif(v[words[i][0]-\'a\'].size()==0){\n\t\t\t\t\t\t\tcontinue;                                 // if first letter is not present then continue\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tlast=*v[words[i][0]-\'a\'].begin();         // else store the min index at which the letter is present\n\t\t\t\t\t}\n\t\t\t\t\tint flag=1;\n\t\t\t\t\tfor(int j=1;j<words[i].size();j++){\n\t\t\t\t\t\tauto it=upper_bound(v[words[i][j]-\'a\'].begin(),v[words[i][j]-\'a\'].end(),last);       \n\n\t\t\t\t\t\tif(it==v[words[i][j]-\'a\'].end()){                          // check if upperbound of last is not present so break\n\t\t\t\t\t\t\tflag=0;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tlast=*upper_bound(v[words[i][j]-\'a\'].begin(),v[words[i][j]-\'a\'].end(),last);\n\t\t\t\t\t\t}                                         // store upper bound value as last character \n\n\t\t\t\t\t}\n\t\t\t\t\tif(flag)\n\t\t\t\t\t\tans++;                                        // if whole string is present then flag==1 , so ans++\n\t\t\t\t}\n\t\t\t\treturn ans;                                         // return ans\n\t\t\t}\n\t\t};\n```\n```
['C', 'Binary Tree', 'C++']