Python solution with backtracking
\nclass Solution:\n    \n    def check_commonality(self, student, mentor):\n        i = 0\n        count = 0\n        while i < len(student):\n            if st
```\nclass Solution:\n    \n    def check_commonality(self, student, mentor):\n        i = 0\n        count = 0\n        while i < len(student):\n            if student[i] == mentor[i]:\n                count+=1\n            i+=1\n        return count\n    \n    def maxCompatibilitySum(self, students: List[List[int]], mentors: List[List[int]]) -> int:\n        matrix = [[0 for x in range(len(mentors))] for y in range(len(students))]\n        \n        for i in range(len(students)):\n            for j in range(len(mentors)):\n                matrix[i][j] = self.check_commonality(students[i], mentors[j])\n        nums_ = []\n        def dfs(i, sum_, visited):\n            if i == len(matrix):\n                nums_.append(sum_)\n                return\n            max_ = 0\n            for j in range(len(matrix[0])):\n                if j not in visited:\n                    visited.append(j)\n                    dfs(i+1, sum_ + matrix[i][j], visited)\n                    visited.pop()\n        dfs(0, 0, [])\n        \n        return max(nums_)\n```
['Combinatorics', 'Python', 'Python3']