Maximum Programmer-Problem Matching
Learn this problemProblem statement
Each problem has a list of tags, and each programmer has a list of skills. A programmer is compatible with a problem when the programmer's skills and the problem's tags share at least one identical string.
Match programmers to problems so that each programmer and each problem appears in at most one pair. Return the maximum possible number of compatible pairs.
Function
maximumProblemMatches(problemTags: List<List<String>>, programmerSkills: List<List<String>>) → intExamples
Example 1
problemTags = [["java"], ["python", "sql"], ["go"]]programmerSkills = [["java", "python"], ["java"], ["rust", "go"]]return = 3The first programmer can take the Python problem, the second programmer can take the Java problem, and the third programmer can take the Go problem. These three pairs use every programmer and problem once, so no larger matching is possible.
Example 2
problemTags = [["java"], ["python"], ["sql"]]programmerSkills = [["java", "python"], ["python"]]return = 2Match the first programmer to the Java problem and the second programmer to the Python problem. Only two programmers are available, so the maximum is 2.