Java Solution without Bitmasking | DP | Memoization
It is the Same solution as given in editorial Approach 2: Top-Down Dynamic Programming (Memoization) but this is an easier way to understand the solution if you
It is the Same solution as given in editorial [Approach 2: Top-Down Dynamic Programming (Memoization)](https://leetcode.com/problems/smallest-sufficient-team/editorial/) but **this is an easier way to understand the solution if you are not comfortable with dp+bitmasking** !\n\n# Code\n```\nclass Solution {\n    public int[] smallestSufficientTeam(String[] req_skills, List<List<String>> people) {\n        dp=new HashMap<>();\n\n        Map<String, Integer> map=new HashMap<>();\n        for(int i=0;i<req_skills.length;i++) {\n            map.put(req_skills[i], i);\n        }\n\n        Set<Integer> ret=util(map, people, new boolean[req_skills.length]);\n        int ans[]=new int[ret.size()];\n        int i=0;\n        for(int x: ret) {\n            ans[i++]=x;\n        }\n        return ans;\n    }\n    \n    private Map<String, Set<Integer>> dp;\n\n    private Set<Integer> util(Map<String, Integer> map, List<List<String>> people, boolean gotSkill[]) {\n        //terminting condition\n        boolean gotAll=true;\n        for(boolean skill: gotSkill) {\n            if(!skill) {\n                gotAll=false;\n                break;\n            }\n        }\n        if(gotAll) return new HashSet<>();\n\n        String key=Arrays.toString(gotSkill);  //for dp\n        if(dp.containsKey(key)) return dp.get(key);\n\n        //main code\n        Set<Integer> ans=null;\n        int minLength=Integer.MAX_VALUE;\n\n        boolean temp[]=gotSkill.clone();\n\n        for(int i=0; i<people.size(); i++) {\n            gotSkill=temp.clone();\n            \n            for(String skill: people.get(i)) {\n                gotSkill[map.get(skill)]=true;\n            }\n\n            boolean anyNew=false;\n            for(int j=0; j<temp.length; j++) {\n                if(temp[j]!=gotSkill[j]) {\n                    anyNew=true;\n                    break;\n                }\n            }\n\n            if(anyNew) { //avoid repetition\n                Set<Integer> ret=new HashSet<>(util(map, people, gotSkill));\n                ret.add(i);\n\n               /* For each person, for each set of skills, we can\n                    update our understanding of a minimum set of people needed to\n                        perform this set of skills. */\n                if(ret.size()<minLength) {\n                    minLength=ret.size();\n                    ans=ret;\n                }\n            }\n        }\n\n        dp.put(key, ans);\n        return ans;\n    }\n}\n```
['Dynamic Programming', 'Bit Manipulation', 'Memoization', 'Bitmask', 'Java']