Loading content...
In a professional assessment scenario, you are tasked with optimally matching candidates to evaluators based on their response alignment.
A questionnaire consisting of n binary questions (answered with either 0 or 1) has been administered to m candidates and m evaluators. Each candidate must be exclusively paired with exactly one evaluator, and each evaluator can assess only one candidate—forming a one-to-one matching.
The alignment score between a candidate-evaluator pair is defined as the count of questions where both provided identical responses.
For instance, if a candidate answered [1, 0, 1] and an evaluator answered [0, 0, 1], their alignment score would be 2 (matching on the second and third questions).
Your objective is to determine the maximum possible sum of alignment scores achievable by optimally assigning each candidate to an evaluator.
candidates: A 2D integer array of dimensions m × n, where candidates[i] represents the binary responses of the i-th candidate.evaluators: A 2D integer array of dimensions m × n, where evaluators[j] represents the binary responses of the j-th evaluator.Return a single integer representing the maximum sum of alignment scores achievable through optimal pairing.
candidates = [[1,1,0],[1,0,1],[0,0,1]]
evaluators = [[1,0,0],[0,0,1],[1,1,0]]8The optimal assignment is:
candidates = [[0,0],[0,0],[0,0]]
evaluators = [[1,1],[1,1],[1,1]]0Every candidate answered all questions with 0, while every evaluator answered all questions with 1. No matter how we pair them, there are zero matching responses. The alignment score for any pairing is 0, so the total sum is 0.
candidates = [[1,0],[0,1]]
evaluators = [[1,0],[0,1]]4With 2 candidates and 2 evaluators:
Constraints