[GoLang] Bitmasking, DP
Approach\nBottom-up DP with bitmasking for skills and team members.\n\n# Complexity\n\ns = len(req_skills)\np = len(people)\n\n- Time complexity: O(2^s\u22C5p)\
# Approach\nBottom-up DP with bitmasking for skills and team members.\n\n# Complexity\n\n`s = len(req_skills)`\n`p = len(people)`\n\n- Time complexity: $$O(2^s\u22C5p)$$\n\n- Space complexity: $$O(2^s)$$\n\n# Code\n```golang []\ntype Team struct {\n    bits, count int\n}\n\nfunc (t Team) getPeopleList() []int {\n    peopleList := []int{}\n    mask := t.bits\n    for i := 0; mask > 0; i++ {\n        if mask % 2 == 1 {\n            peopleList = append(peopleList, i)\n        }\n        mask /= 2\n    }\n    return peopleList\n}\n\nfunc smallestSufficientTeam(req_skills []string, people [][]string) []int {\n    sn, pn := len(req_skills), len(people)\n\n    skillIdx := map[string]int{}\n    for j, skill := range req_skills {\n        skillIdx[skill] = j\n    }\n\n    peopleSkillMask := make([]int, pn)\n    for i := range people {\n        for _, skill := range people[i] {\n            j := skillIdx[skill]\n            peopleSkillMask[i] |= 1<<j\n        }\n    }\n\n    dp := make([]Team, 1<<sn)\n\n    // no skills require no people\n    dp[0] = Team{0, 0}\n    // by default for every non empty set of skills require all people\n    for skillsMask := 1; skillsMask < len(dp); skillsMask++ {\n        dp[skillsMask] = Team{(1<<pn) - 1, pn}\n    }\n\n    for skillsMask := 0; skillsMask < len(dp)-1; skillsMask++ {\n        // here in this cycle dp[skillsMask] is already calculated before \n        // and contains smallest team (bits represent people)\n        team := dp[skillsMask]\n\n        for i := range people {\n            // this person is already in the team and all his skill are counted\n            if team.bits & (1<<i) != 0 { continue }\n\n            // dump persons with no skills\n            if peopleSkillMask[i] == 0 { continue }\n\n            newTeamCount := team.count + 1\n            newSkillMask := skillsMask | peopleSkillMask[i]\n            \n            // if newTeam is smaller for newSkillMask, then use it\n            if newTeamCount < dp[newSkillMask].count {\n                dp[newSkillMask].bits = team.bits | (1<<i)\n                dp[newSkillMask].count = newTeamCount\n            }\n        }\n    }\n\n    allSkillsMask := 1<<sn - 1\n    return dp[allSkillsMask].getPeopleList()\n}\n\n```
['Go']