Beats 99.64% | C++ | top down DP | Bit Manipulation
code represents an integer whose i-th bit is 1 if i-th skill is already picked. \npeople_map[i] represents the skill code for i-th person where skillcode is an 
**code** represents an integer whose i-th bit is 1 if i-th skill is already picked. \n**people_map[i]** represents the skill code for i-th person where skillcode is an integers whose j-th bit is 1 if j-th skill is known.\n\nIdea is simple. \nTo find the smallest team for a given code, \n* find a skill not already present in code using `(code & (1<<i)) == 0`\n* for each person having this skill :-\n\t* pick this person and add all skills of this person to the code using `newCode = code | people_map[p];`\n\t* find smallest team for the newCode\n* the smallest team from the above loop will be the result\n \n\n```\nclass Solution {\npublic:\n    \n    unordered_map<int, vector<int> > minSizeMap;\n    \n    vector<int> minTeam(int code, vector<int>& people_map, int sn){\n        if(code == pow(2, sn)-1){\n            //cout << code;\n            return vector<int>();\n        }\n        if(minSizeMap.count(code)){\n            return minSizeMap[code];\n        }\n        \n        int i;\n        for(i=0; i<sn; i++){\n           // cout << (code & (1<<i)) << "< ";\n           if((code & (1<<i)) == 0)\n                break;\n        }\n        \n        int minSize = INT_MAX;\n        vector<int> result;\n        for(int p=0; p<people_map.size(); p++){\n           // cout << code << "," << (people_map[p] & (1<<i)) << " ;";\n            if((people_map[p] & (1<<i)) != 0){\n                int newCode = code | people_map[p];\n                vector<int> subResult = minTeam(newCode, people_map, sn);\n                subResult.push_back(p);\n                if(subResult.size() < minSize){\n                    result = subResult;\n                    minSize = subResult.size();\n                }\n            }\n        }\n        \n        minSizeMap[code] = result;\n        return result;\n    }\n    \n    vector<int> smallestSufficientTeam(vector<string>& req_skills, vector<vector<string>>& people) {\n        int rn = req_skills.size(), pn = people.size();\n        unordered_map<string, int> skillPosMap;\n        for(int i=0; i<rn; i++){\n            skillPosMap[req_skills[i]] = i;\n        }\n        \n        vector<int> people_map;\n        for(vector<string> pskill: people){\n            int skillCode = 0;\n            for(string sk: pskill){\n                skillCode = skillCode | (1<<skillPosMap[sk]);\n            }\n            people_map.push_back(skillCode);\n        }\n        \n        return minTeam(0, people_map, rn);\n    }\n};\n```
['Dynamic Programming', 'Bitmask']