Description
Given a list of required skills and a list of people with their skills, return any sufficient team of the smallest possible size, represented as indices of people.
Examples
Input:
req_skills = ["java","nodejs","reactjs"], people = [["java"],["nodejs"],["nodejs","reactjs"]]Output:
[0,2]Explanation:
People 0 and 2 cover all skills.
Input:
req_skills = ["java","nodejs","reactjs"], people = [[1]]Output:
[1]Explanation:
Minimal case with a single-element matrix.
Input:
req_skills = ["python","sql","docker","aws"], people = [["python","sql"],["docker"],["aws","python"],["sql","docker","aws"]]Output:
[0,3]Explanation:
Person 0 has ["python","sql"] and person 3 has ["sql","docker","aws"]. Together they cover all required skills: python, sql, docker, and aws. This is optimal since no single person covers all skills, and at least 2 people are needed.
Constraints
- •
1 ≤ req_skills.length ≤ 16 - •
1 ≤ people.length ≤ 60