✅ C++ | ✅ Simple Solution | ✅ Memo DP | ✅ Knapsack | ✅ Bit masking
\n\n# Code\n\nclass Solution {\n\n    vector<int> peopleMask;\n    vector<vector<int>> dp;\n    int n, m, maxMask;\n    \n\n    void PreProcess(vector<string>& 
\n\n# Code\n```\nclass Solution {\n\n    vector<int> peopleMask;\n    vector<vector<int>> dp;\n    int n, m, maxMask;\n    \n\n    void PreProcess(vector<string>& req_skills, vector<vector<string>>& people)\n    {\n        n = req_skills.size();\n        m = people.size();\n        maxMask = (1 << n) - 1;\n        unordered_map<string, int> strToInt;\n        peopleMask.resize(m);\n        dp = vector<vector<int>>(m, vector<int>(maxMask + 1, -1));;\n\n        for(int i = 0; i < n; i++)\n            strToInt[req_skills[i]] = i;\n\n        for(int i = 0; i < m; i++)\n        {\n            int mask = 0;\n            for(auto &skill : people[i])\n                mask = mask | (1 << strToInt[skill]);\n            peopleMask[i] = mask;\n        }\n    }\n\n\n    int DFS(int index, int mask)\n    {\n        if(mask == maxMask)\n            return 0;\n\n        if(index >= m)\n            return n + 1; \n\n        if(dp[index][mask] != -1)\n            return dp[index][mask];\n\n        int skip = DFS(index + 1, mask);\n        \n        int keep = 1 + DFS(index + 1, mask | peopleMask[index]);\n\n        return dp[index][mask] = min(skip, keep);\n    }\n    \n    vector<int> CreateArray()\n    {\n        vector<int> ans;\n        int index = 0, mask = 0;\n        \n        while(index < m && mask != maxMask)\n        {\n            if(index + 1 >= m || 1 + dp[index + 1][mask | peopleMask[index]] < dp[index + 1][mask])\n            {\n                ans.push_back(index);\n                mask = mask | peopleMask[index];\n            }\n            index++;\n        }\n\n        return ans;\n    }\n\npublic:\n    vector<int> smallestSufficientTeam(vector<string>& req_skills, vector<vector<string>>& people) {\n        \n        \n        PreProcess(req_skills, people);\n        \n        DFS(0, 0);\n        \n        return CreateArray();\n    }\n};\n```
['Dynamic Programming', 'Recursion', 'Memoization', 'Bitmask', 'C++']