DP Memoization + DP Tabulation + Hashmap Approach
\n    /\n    Memoization Approach\n    int solve(int i, int j, string &s1, string &s2, vector> &dp) {\n        if(i < 0 || j < 0)\n        return 0;\n        \n
\n    /*\n    Memoization Approach\n    int solve(int i, int j, string &s1, string &s2, vector<vector<int>> &dp) {\n        if(i < 0 || j < 0)\n        return 0;\n        \n        if(dp[i][j] != -1)\n        return dp[i][j];\n        \n        if(s1[i] == s2[j]) {\n            return dp[i][j] = 1+solve(i-1, j-1, s1, s2, dp);\n        }\n        else {\n            return dp[i][j] = solve(i, j-1, s1, s2, dp);\n        }\n    }\n    */\n    /*\n    Tabulation Approach\n    int numMatchingSubseq(string s, vector<string>& words) {\n        int n = s.length();\n        int cnt = 0;\n        for(int k=0; k<words.size(); k++) {\n            string t = words[k];\n            int m = t.length();\n            vector<vector<int>> dp(m+1, vector<int> (n+1, 0));\n            \n            for(int i=1; i<=m; i++) {\n                for(int j=1; j<=n; j++) {\n                    if(t[i-1] == s[j-1]) {\n                        dp[i][j] = 1 + dp[i-1][j-1];\n                    }\n                    else {\n                        dp[i][j] = dp[i][j-1];\n                    }\n                }\n            }\n            if(dp[m][n] == m)\n                cnt++;\n        }\n        return cnt;\n    }\n    */\n    /*\n    Optimization using map/FreqVector:\n    -> Store the index of occurrence of characters of string s \n    -> Use of binary search to find next possible index in map for occurence of characters\n    -> Flag to mark false if a character is not already present in map\n    -> Count if the flag is true and continue with next word\n    -> Return the count\n    */\n    int numMatchingSubseq(string s, vector<string>& words) {\n        int n = s.length();\n        vector<vector<int>> mapStore(26);\n        for(int i=0; i<n; i++) {\n            mapStore[s[i]-\'a\'].push_back(i);\n        }\n        \n        int cnt = 0;\n        for(int k=0; k<words.size(); k++) {\n            string t = words[k];\n            int m = t.length();\n            int x = -1;\n            bool flag = true;\n            \n            for(auto c: t) {\n                auto it = upper_bound(mapStore[c-\'a\'].begin(), mapStore[c-\'a\'].end(), x);\n                if(it == mapStore[c-\'a\'].end())\n                    flag = false;\n                else\n                    x = *it;\n                \n                if(flag == false)\n                    break;\n            }\n            if(flag)\n                cnt++;\n        }\n        return cnt;\n    }\n\n\nIf you liked my approach...please upvote!!
['Dynamic Programming', 'Memoization', 'C']