Concise Python DFS, BFS
DFS+Memo (1000ms defeats 18%):\n\nimport functools\nclass Solution:\n    def smallestSufficientTeam(self, req_skills: List[str], people: List[List[str]]) -> Lis
DFS+Memo (1000ms defeats 18%):\n```\nimport functools\nclass Solution:\n    def smallestSufficientTeam(self, req_skills: List[str], people: List[List[str]]) -> List[int]:\n        d={s:i for i,s in enumerate(req_skills)}\n        people_masks=[functools.reduce(lambda s,x: s|1<<d[x], p, 0) for p in people]\n        @functools.lru_cache(None)\n        def dfs(mask, idx):\n            if mask==0:\n                return 0,[]\n            if idx>=len(people):\n                return math.inf, []\n            l1,arr1=dfs(mask,idx+1)\n            l2,arr2=dfs(mask&(~people_masks[idx]),idx+1)\n            if l2<l1:\n                return l2+1,[idx]+arr2\n            return l1,arr1\n        return dfs(2**len(req_skills)-1,0)[1]            \n```\nBFS (280ms defeats 40%):\n```\nimport functools            \nclass Solution:\n    def smallestSufficientTeam(self, req_skills: List[str], people: List[List[str]]) -> List[int]:\n        d={v:i for i,v in enumerate(req_skills)}\n        dp={0:[]}\n        n=len(people)\n        people_masks=[functools.reduce(lambda s,x: s|1<<d[x], p, 0) for p in people]\n        que=[[0,i] for i in range(n)][::-1]\n        target=2**len(req_skills)-1\n        while que:\n            tmp=[]\n            for q in que:\n                mask,p=q[0],people[q[1]]\n                tmp2=dp[mask]+[q[1]]\n                mask|=people_masks[q[1]]\n                if mask==target:\n                    return tmp2\n                if mask not in dp:\n                    dp[mask]=tmp2\n                    for i in range(q[1]+1,n):\n                        tmp.append([mask,i])\n            que=tmp\n```
[]