Java bit dp with comments
\nimport java.util.*;\n\nclass Solution {\n\n    public int[] smallestSufficientTeam(String[] req_skills, List<List<String>> people) {\n        int n = req_skil
```\nimport java.util.*;\n\nclass Solution {\n\n    public int[] smallestSufficientTeam(String[] req_skills, List<List<String>> people) {\n        int n = req_skills.length;\n        // number the skills\n        Map<String, Integer> skills = new HashMap<>();\n        for (String skill : req_skills) {\n            skills.put(skill, skills.size());\n        }\n\n        // there are max 16 skills could be required, so number of permutations\n        // up to 2^16 => fit integer\n        List<Integer> candidates = new ArrayList<>();\n        for (List<String> candidate : people) {\n            int skill = 0;\n            for (String candidateSkill : candidate) {\n                skill |= (1 << skills.get(candidateSkill));\n            }\n            candidates.add(skill);\n        }\n\n        // but there could be up to 60 teammates in team,\n        // so number permutations 2^60. we need Long\n        long[] skillsSet = new long[1 << n];\n\n        // -1 is perfect default value. all ones in binary representation, easy to check is it set up or not\n        Arrays.fill(skillsSet, -1);\n        skillsSet[0] = 0;\n\n        // so the main idea is: we do only care about team composition\n        // and do not care about order at all\n        for (int i = 0; i < candidates.size(); i++) {\n            // so we take candidate\n            int candidateSkills = candidates.get(i);\n            for (int j = 0; j < skillsSet.length; j++) {\n                //and try to add it to all existing teams\n                if (skillsSet[j] == -1) continue;\n                // start with 0, so all candidates represents in skillSet\n                // if only we do not have 2 candidates with same skills\n                int update = Long.bitCount(skillsSet[j|candidateSkills]);\n                int current = Long.bitCount(skillsSet[j]);\n                // if we could archive same skill set with less team members we must do it\n                if (update > current + 1) {\n                    skillsSet[j| candidateSkills] = skillsSet[j] | (1L << i);\n                }\n            }\n        }\n\n        int[] res = new int[Long.bitCount(skillsSet[(1<<n)-1])];\n        int i = 0;\n        int k = 0;\n        while ( (1L << i) <= skillsSet[(1<<n)-1]) {\n            if ( ((1L << i) & skillsSet[(1<<n)-1]) != 0) res[k++] = i;\n            i++;\n        }\n\n        return res;\n    }\n}\n```
[]