Pick the Smallest Consultant Team Covering Every Required Skill
Last updated: November 29, 2026
Quick Overview
Given a project's required skills (at most 20) and a bench of consultants each with a set of skills, return the smallest group of consultants whose combined skills cover all requirements, or None if impossible.
Cognizant
November 29, 20260
0
0 solved
Given a project's required skills (at most 20) and a bench of consultants each with a set of skills, return the smallest group of consultants whose combined skills cover all requirements, or None if impossible.
Staffing a client engagement from a large bench is a core Cognizant workflow, and an internal tooling interview might frame set cover this way. The interviewer wants you to recognize that set cover is NP-hard in general, notice the small skill count, and use a bitmask DP with sensible pruning.
What the Interviewer Expects
- Identifies the problem as set cover and says greedy is not optimal
- Encodes skills as bit positions and consultants as masks
- Uses DP over 2^S masks with reconstruction of the chosen team
- Prunes consultants whose skills are a subset of another's
- Handles the impossible case and empty requirements
- States O(2^S * n) time and O(2^S) space
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- The bench has 30,000 people and 25 skills. What breaks and what would you do?
- Consultants now have day rates and you want the cheapest team, not the smallest. What changes?
- Some skills need two people (two Java developers). How do you model that?
- When is the greedy approximation good enough for a staffing tool?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Inputs: required, a list of up to 20 skill names, and consultants, a list of (name, skills). Output: a minimum-size list of names whose union of skills includes every required skill. Skills not ...
High-Level Design
Map each required skill to a bit, turning each consultant into an integer mask. Drop zero masks and dominated consultants (mask is a subset of a kept mask), which shrinks real benches dramatically bec...