My very slow (4224ms!!) brute force (Python)
This is my very slow, but lovely brute force solution.\nIt\'s so straightforward, so I think it\'s self-explanatory.\n\n\nfrom itertools import permutations\n\n
This is my very slow, but lovely brute force solution.\nIt\'s so straightforward, so I think it\'s self-explanatory.\n\n```\nfrom itertools import permutations\n\nclass Solution:\n    def maxCompatibilitySum(self, students, mentors) -> int:\n        def calc(lst1, lst2):\n            res = 0\n            for num1, num2 in zip(lst1, lst2):\n                res += num1 == num2\n            return res\n\n        R = len(students)\n        all_pairs = list(permutations(range(R)))\n\n        res = 0\n        for pair in all_pairs:\n            score = 0\n            for idx1, idx2 in enumerate(pair):\n                score += calc(students[idx1], mentors[idx2])\n            res = max(res, score)\n        return res\n```
[]