Tap here to switch tabs
Problem
Submissions

Problem: Maximum Compatibility Score Sum

med
30 min
Try to solve the Maximum Compatibility Score Sum problem.

Statement

There are m students and m mentors, each labeled from 00 to m −1- 1. You are given two 22D integer arrays students and mentors of dimensions m $ imes$ n, where students[i] and mentors[j] represent the responses of student i and mentor j to n survey questions.

The compatibility score between student i and mentor j is defined as the number of questions for which their answers match (specifically, the count of indices k where students[i][k] == mentors[j][k]).

Every student must be assigned to exactly one mentor, and each mentor must be assigned to exactly one student.

Return the maximum possible compatibility score sum across all assignments.

Constraints:

  • m == students.length == mentors.length

  • n == students[i].length == mentors[j].length

  • 1≤1 \leq m, n ≤8\leq 8

  • students[i][k] is either 00 or 11.

  • mentors[j][k] is either 00 or 11.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Compatibility Score Sum

med
30 min
Try to solve the Maximum Compatibility Score Sum problem.

Statement

There are m students and m mentors, each labeled from 00 to m −1- 1. You are given two 22D integer arrays students and mentors of dimensions m $ imes$ n, where students[i] and mentors[j] represent the responses of student i and mentor j to n survey questions.

The compatibility score between student i and mentor j is defined as the number of questions for which their answers match (specifically, the count of indices k where students[i][k] == mentors[j][k]).

Every student must be assigned to exactly one mentor, and each mentor must be assigned to exactly one student.

Return the maximum possible compatibility score sum across all assignments.

Constraints:

  • m == students.length == mentors.length

  • n == students[i].length == mentors[j].length

  • 1≤1 \leq m, n ≤8\leq 8

  • students[i][k] is either 00 or 11.

  • mentors[j][k] is either 00 or 11.