Tap here to switch tabs
Problem
Submissions

Problem: Smallest Sufficient Team

Smallest Sufficient Team chooses the fewest people whose combined skills cover every required skill, returning the indices of one such sufficient team.

Statement

Given an array of strings req_skills containing required skills, and an array of lists of strings people where people[i] contains the skills possessed by the ithi^{th} individual.

A team is considered sufficient if every skill in req_skills is possessed by at least one member of the team.

Return the indices of the members in a sufficient team of the smallest possible size. You may return the indices in any order.

Constraints:

  • 1≤req_skills.length≤161 \leq \text{req\_skills.length} \leq 16

  • 1≤req_skills[i].length≤161 \leq \text{req\_skills[i].length} \leq 16

  • req_skills[i] consists of lowercase English letters.

  • All the strings of req_skills are unique.

  • 1≤people.length≤601 \leq \text{people.length} \leq 60

  • 0≤people[i].length≤160 \leq \text{people[i].length} \leq 16

  • 1≤people[i][j].length≤161 \leq \text{people[i][j].length} \leq 16

  • people[i][j] consists of lowercase English letters.

  • All the strings of people[i] are unique.

  • Every skill in people[i] is a skill in req_skills.

  • It is guaranteed a sufficient team exists.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Smallest Sufficient Team

Smallest Sufficient Team chooses the fewest people whose combined skills cover every required skill, returning the indices of one such sufficient team.

Statement

Given an array of strings req_skills containing required skills, and an array of lists of strings people where people[i] contains the skills possessed by the ithi^{th} individual.

A team is considered sufficient if every skill in req_skills is possessed by at least one member of the team.

Return the indices of the members in a sufficient team of the smallest possible size. You may return the indices in any order.

Constraints:

  • 1≤req_skills.length≤161 \leq \text{req\_skills.length} \leq 16

  • 1≤req_skills[i].length≤161 \leq \text{req\_skills[i].length} \leq 16

  • req_skills[i] consists of lowercase English letters.

  • All the strings of req_skills are unique.

  • 1≤people.length≤601 \leq \text{people.length} \leq 60

  • 0≤people[i].length≤160 \leq \text{people[i].length} \leq 16

  • 1≤people[i][j].length≤161 \leq \text{people[i][j].length} \leq 16

  • people[i][j] consists of lowercase English letters.

  • All the strings of people[i] are unique.

  • Every skill in people[i] is a skill in req_skills.

  • It is guaranteed a sufficient team exists.