Smallest Team With Every Skill
skills lists the different skills a job needs, and people[i] lists the skills person i has, all of them taken from skills. Every needed skill is held by at least one person.
Return the size of the smallest team whose members together have every skill in skills.
Example 1
skills ["cook","drive","sing"]
people [["cook"],["drive","sing"],["cook","sing"],["drive"]]
returns 2
Person 0 cooks, and person 1 drives and sings. Nobody has all three skills alone.
Example 2
skills ["row"]
people [["row"],["row"]]
returns 1
Either person is enough.
Constraints
1 <= len(skills) <= 101 <= len(people) <= 40people[i]holds different skills fromskills, possibly none
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Bits problems
- Split Powers to Hit a TotalHard
- Build a MaskBeginner
- Fixed Width BinaryBeginner
- Flip One BitBeginner
- Gray Code SequenceBeginner
- How Many Bits LongBeginner
- Keep the Low BitsBeginner
- Lowest Set BitBeginner