Get the correct intuition and approach behind this question !
Intuition\nIdea was to create a bitmask for every persons skill.\nExample if we have skills - [1,2,3,4,5];\nAnd a person have skills - [1,5];\nwe should make ma
# Intuition\nIdea was to create a bitmask for every persons skill.\nExample if we have skills - [1,2,3,4,5];\nAnd a person have skills - [1,5];\nwe should make mask for that person as - 10001;\nThis thing is stored in vector - people_skills\n\n# Approach\n* Go for each person -> you have two choice weather to take it or not;\n* Run both cases recursively.\n* if You are taking it update the mask for next call and push it into curr ans.\n* After returning from that call,pop back the index (Backtracking);\n\n# Base Case\n* if(mask == (1<<m-1)) i.e all skills req have been selected\n    * Check for curr ans size and res size. If curr is smaller make curr as our answer. And return,\n* if(curr index >= person_skill size) return;\n\n# Complexity\n- Time complexity:\nO(n*m);\n\n- Space complexity:\nO(n*m)\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> res;\n    void func(int i,vector<int>& people_skill,int m,int mask,vector<int>& ans,vector<vector<int>>& dp){\n        if(mask == ((1<<m)-1)){\n            if(res.size()==0 or ans.size()<res.size()) res=ans;\n            return;\n        }\n        if(i==people_skill.size()) return;\n        if(dp[i][mask]!=-1 and dp[i][mask]<=ans.size()) return;\n        func(i+1,people_skill,m,mask,ans,dp);\n        ans.push_back(i);\n        func(i+1,people_skill,m,mask|people_skill[i],ans,dp);\n        ans.pop_back();\n        if(ans.size()>0) dp[i][mask] = ans.size(); \n    }\n    vector<int> smallestSufficientTeam(vector<string>& req_skills, vector<vector<string>>& people) {\n        int n = people.size();\n        int m = req_skills.size();\n        unordered_map<string,int> mp;\n        for(int i=0;i<m;i++){\n            mp[req_skills[i]] = 1<<i;\n        }\n        vector<int> people_skill;\n        for(auto it:people){\n            int mask = 0;\n            for(int j=0;j<it.size();j++){\n                if(mp.count(it[j])) mask |=mp[it[j]];\n            }\n            people_skill.push_back(mask);\n        }\n        vector<vector<int>> dp(n,vector<int> (1<<m,-1));\n        vector<int> ans;\n        func(0,people_skill,m,0,ans,dp);\n        return res;\n    }\n};\n```
['Dynamic Programming', 'Backtracking', 'Bitmask', 'C++']