simple BFS | faster than 84.10% | space less than 80.59%
each time we can have m(length of people) choice if not already visited in bfs.\nAnd once we reach (1 << n) - 1, we are done.\nwe can store x came from y using 
each time we can have m(length of people) choice if not already visited in bfs.\nAnd once we reach (1 << n) - 1, we are done.\nwe can store x came from y using i at the end.\nso parent[x] = {y, i};\nAnd regain the order by going reverse from parent[(1 << n) - 1];\n```\nclass Solution {\npublic:\n    vector<int> smallestSufficientTeam(vector<string>& skills, vector<vector<string>>& people) {\n        int n = (int)skills.size();\n        int m = (int)people.size();\n        vector<pair<int, int>>parent(1 << n, make_pair(-1, -1));\n        queue<int>q;\n        vector<int>a(m, 0);\n        map<string, int>ind;\n        for(int i = 0; i < n; ++i)ind[skills[i]] = i;\n        for(int i = 0; i < m; ++i){\n            for(string j : people[i]){\n                a[i] += (1 << ind[j]);\n            }\n        }\n        vector<bool>visited(1 << n, false);\n        int req = (1 << n) - 1;\n        for(int i = 0; i < m; ++i){\n            q.push(a[i]);\n            parent[a[i]] = {0, i};\n            visited[a[i]]= true;\n        }\n        \n        while(!q.empty()){\n            int num = q.front();q.pop();\n            if(num == req)break;\n            for(int i = 0; i < m; ++i){\n                if(num == (num | a[i]))continue;\n                int next = num | a[i];\n                if(!visited[next]){\n                    q.push(next);\n                    visited[next] = true;\n                    parent[next] = {num, i};\n                }\n            }\n        }\n        vector<int>ans;\n        int num = (1 << n) - 1;\n        while(num > 0){\n            ans.push_back(parent[num].second);\n            num = parent[num].first;\n        }\n        return ans;\n    }\n};\n```
[]