[Java] DFS Backtracking
\n    int teamSize;\n    HashSet<Integer> resTeam;\n    public int[] smallestSufficientTeam(String[] req_skills, List<List<String>> people) {\n        teamSize 
```\n    int teamSize;\n    HashSet<Integer> resTeam;\n    public int[] smallestSufficientTeam(String[] req_skills, List<List<String>> people) {\n        teamSize = people.size()+1;\n        resTeam = new HashSet();\n        HashMap<String,List<Integer>> skillMap = new HashMap();\n        for(int i=0; i<people.size(); i++){\n            for(String skill : people.get(i)){\n                if(!skillMap.containsKey(skill)){\n                    skillMap.put(skill, new ArrayList<Integer>());\n                }\n                skillMap.get(skill).add(i);\n            }\n        }\n        find(skillMap, req_skills, 0, new HashSet());\n        int[] res = new int[resTeam.size()];\n        int index = 0;\n        for(int person : resTeam){\n            res[index++] = person;\n        }\n        return res;\n    }\n    \n    public void find(HashMap<String,List<Integer>> skillMap, String[] req_skills, int cur, HashSet<Integer> team){\n        if(team.size()>teamSize) return;\n        if(cur==req_skills.length){\n            if(team.size()<teamSize){\n                teamSize = team.size();\n                resTeam = new HashSet<Integer>();\n                resTeam.addAll(team);\n            }\n            return;\n        }\n        for(int person : skillMap.get(req_skills[cur])){\n            boolean isRemove = !team.contains(person);\n            team.add(person);\n            find(skillMap, req_skills, cur+1, team);\n            if(isRemove) team.remove(person);\n        }\n    }\n```
[]