Very easy to understand C++.
Intuition\n1.Create a mask array using bitmasking.\n2.pass the 0th index to th erecusive function.\n3.write the base case teh function returns a mask number.\n4
# Intuition\n1.Create a mask array using bitmasking.\n2.pass the 0th index to th erecusive function.\n3.write the base case teh function returns a mask number.\n4.that number tells us the list of those indices as set bits..\n\n# Approach\nCreating a mask array for every person using bitmasking.Now use pick/notpick to find minimum person to take every course.\n\n# Complexity\n- Time complexity:\nO(2^n)\n\n- Space complexity:\n- O(2^n)\n\n# Code\n```\n#define ll long long\nclass Solution {\npublic:\n    unordered_map<string, ll> dp;\n    vector<int> mask;\n ll f(int k, int idx, int currmask) {\n        if (currmask == k)\n            return 0;\n\n        if(idx == mask.size())\n            return INT_MAX;\n\n        string key = to_string(idx)+" "+to_string(currmask);\n        if (dp.count(key))\n            return dp[key];\n        ll ans = INT_MAX;\n        ll pick = f(k,idx+1, currmask | mask[idx]);\n        ll notPick = f(k, idx + 1, currmask);\n        if (__builtin_popcountll(pick) < __builtin_popcountll(notPick)) \n         ans=pick | (1LL << idx);\n         else \n         ans = notPick;\n\n        dp[key] = ans;\n        return ans;\n    }\n    vector<int> smallestSufficientTeam(vector<string>& req_skills, vector<vector<string>>& people) {\n        unordered_map<string, int> mp;\n        for (int i = 0; i < req_skills.size(); i++) {\n            mp[req_skills[i]] = i;\n        }\n        mask.resize(people.size(), 0);\n        for (int i = 0; i < people.size(); i++) {\n            vector<string>& temp = people[i];\n            int t = 0;\n            for (string& skill : temp) {\n                t |= 1 << mp[skill];\n            }\n            mask[i] = t;\n        }\n\n        int k = (1 << req_skills.size()) - 1;\n        dp.clear();\n        ll cnt = f(k,0,0);\n        vector<int> ans;\n        int index = 0;\n        while (cnt > 0) {\n            ll pick = cnt & 1;\n            if (pick == 1) {\n                ans.push_back(index);\n            }\n            index++;\n            cnt >>= 1;\n        }\n        return ans;\n    }\n};\n\n```
['Hash Table', 'Dynamic Programming', 'Memoization', 'Bitmask', 'C++']