bitmask | choose or not to choose
\nclass Solution {\npublic:\n\n   vector<int>temp;\n\n   void func(int i, vector<int>pep_skill,int mask,vector<int>&ans,int n,vector<vector<int>> &dp)\n   {\n  
```\nclass Solution {\npublic:\n\n   vector<int>temp;\n\n   void func(int i, vector<int>pep_skill,int mask,vector<int>&ans,int n,vector<vector<int>> &dp)\n   {\n      if(i==pep_skill.size())\n      {\n          if(mask == (1<<n)-1) // all bits are 1\n          {\n            if(temp.size()==0 || temp.size()>ans.size()) // prev store array is bigger \n            {\n               temp=ans;\n            }\n          }\n          return ;\n      }\n      if(dp[i][mask]!=-1) \n      {\n          if(dp[i][mask] <= ans.size()) return;\n      }\n\n\n\n\n      func(i+1,pep_skill,mask,ans,n,dp);  // notTake condition\n \n      ans.push_back(i);\n      func(i+1,pep_skill,(mask | pep_skill[i]),ans,n,dp); // take condition\n      ans.pop_back();\n\n      dp[i][mask] = (ans.size() != 0) ? ans.size() : -1;\n\n   }\n    vector<int> smallestSufficientTeam(vector<string>& req_skills, vector<vector<string>>& people) {\n       \n       int n=req_skills.size();\n       int m=people.size();\n\n       vector<int>pep_skill;\n\n       for(int i=0;i<m;i++)\n       {\n           int skill=0;\n           for(int j=0;j<people[i].size();j++)\n           {\n               for(int k=0;k<n;k++)\n               {\n                  if(people[i][j]==req_skills[k])\n                  {\n                      skill=skill | (1<<k);  // setting the mask for each people skills\n                  }\n               }\n           }\n           pep_skill.push_back(skill);\n\n       }\n        vector<int>ans;\n\n        int target=pow(2,n); \n\n        vector<vector<int>> dp(m, vector<int>(target, -1));  // [index][target]  because 00 can to to max to 11 or 2^n \n\n        func(0,pep_skill,0,ans,n,dp);\n        return temp;\n\n    }\n\n};\n```
['C']