c++ | easy | short
\n# Code\n\nclass Solution {\npublic:\n    int maxCompatibilitySum(vector<vector<int>>& students, vector<vector<int>>& mentors) {\n\tint ans = 0;\n\tvector<int>
\n# Code\n```\nclass Solution {\npublic:\n    int maxCompatibilitySum(vector<vector<int>>& students, vector<vector<int>>& mentors) {\n\tint ans = 0;\n\tvector<int> pos;\n\tfor(int i=0;i<students.size();i++) pos.push_back(i);\n\tdo{\n\t\tint curr = 0;\n\t\tfor(int i = 0;i<students.size(); i++)\n\t\t\tfor(int j=0;j<students[pos[i]].size();j++)\n\t\t\t\tcurr += (students[pos[i]][j] == mentors[i][j]);\n\t\tans = max(ans, curr);\n\t} while(next_permutation(pos.begin(), pos.end()) );\n\treturn ans;\n}\n};\n```
['C++']