A new frontend project needs every skill in skills. Candidate i has the skills listed in people[i]. A team covers a skill if at least one member has it.
Write smallestTeam(skills, people) that returns the fewest people whose combined skills cover every required skill. Some team always exists.
Input: skills = ["react","css","node"], people = [["react"],["css","node"],["react","css"]] Output: 2
People 0 and 1 together know all three skills; nobody knows all three alone.
Input: skills = ["a11y"], people = [["a11y"]] Output: 1
One person covers the only skill.
1 <= skills.length <= 161 <= people.length <= 60skills.Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #560 Smallest Team Covering Every Skill. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.