C# | Runtime beats 80.00%, Memory beats 65.00% [EXPLAINED]
Intuition\nI wanted to find the smallest group of people that together have all the required skills. By using bitmasks to represent skill combinations, I could 
# Intuition\nI wanted to find the smallest group of people that together have all the required skills. By using bitmasks to represent skill combinations, I could track the best team for each set of skills.\n\n# Approach\nI converted each person\u2019s skills into a bitmask. Then, for each skill combination, I checked if adding a person created a smaller team. I kept updating the smallest team for each skill set until all skills were covered.\n\n# Complexity\n- Time complexity:\nO(people.length * 2^skills.length) \u2014 We process each person for every possible skill combination.\n\n- Space complexity:\nO(2^skills.length) \u2014 We store the best team for each skill combination.\n\n# Code\n```csharp []\npublic class Solution {\n    public int[] SmallestSufficientTeam(string[] req_skills, IList<IList<string>> people) {\n        int n = req_skills.Length;\n        int targetMask = (1 << n) - 1;  // Bitmask for all required skills\n\n        // Map each skill to a bit index\n        var skillIndex = new Dictionary<string, int>();\n        for (int i = 0; i < n; i++) {\n            skillIndex[req_skills[i]] = i;\n        }\n\n        // DP to store the smallest team for each bitmask\n        var dp = new Dictionary<int, List<int>>();\n        dp[0] = new List<int>();  // Starting point with no skills\n\n        // Process each person and their skills\n        for (int i = 0; i < people.Count; i++) {\n            int personSkills = 0;\n\n            // Convert current person\'s skills to a bitmask\n            foreach (var skill in people[i]) {\n                if (skillIndex.ContainsKey(skill)) {\n                    personSkills |= (1 << skillIndex[skill]);\n                }\n            }\n\n            if (personSkills == 0) continue;  // Skip if the person has no useful skills\n\n            // Update the dp table by iterating over the current state\n            var currentDp = new List<int>(dp.Keys);  // Avoid modifying dp while iterating\n            foreach (int mask in currentDp) {\n                int newMask = mask | personSkills;  // Combine current skills with the person\'s skills\n\n                // If we already have a smaller or equal-sized team for this newMask, skip updating\n                if (!dp.ContainsKey(newMask) || dp[newMask].Count > dp[mask].Count + 1) {\n                    // Build a new team by adding this person to the current team\n                    var newTeam = new List<int>(dp[mask]) { i };\n                    dp[newMask] = newTeam;\n                }\n            }\n        }\n\n        // Return the result for the full skills set (targetMask)\n        return dp[targetMask].ToArray();\n    }\n}\n\n```
['C#']