Scala. Extremely simple, easy to understand and ineffective
\n  def maxCompatibilitySum(students: Array[Array[Int]], mentors: Array[Array[Int]]): Int =\n    search(students.toList, mentors.toSet)\n\n  def search(students
```\n  def maxCompatibilitySum(students: Array[Array[Int]], mentors: Array[Array[Int]]): Int =\n    search(students.toList, mentors.toSet)\n\n  def search(students: List[Array[Int]], mentors: Set[Array[Int]]): Int =\n    students match {\n      case Nil => 0\n      case s :: tail => mentors.map(m => compatibility(s, m) + search(tail, mentors - m)).max\n    }\n\n  def compatibility(s: Array[Int], m: Array[Int]): Int = s.zip(m).count { case(s, m) => s == m } \n  ```
[]