✅✅C++ || Permutation || Easy to Understand || Backtracking
\nclass Solution {\npublic:\n    vector<int>visited;\n    int maxCompatibilitySum(vector<vector<int>>& students, vector<vector<int>>& mentors) {\n        int n 
```\nclass Solution {\npublic:\n    vector<int>visited;\n    int maxCompatibilitySum(vector<vector<int>>& students, vector<vector<int>>& mentors) {\n        int n = students.size();\n        int m = students[0].size();\n        visited.resize(n+1, 0);\n        return permutation(students, mentors, 0, n, m);\n    }\n    int permutation(vector<vector<int>>& students, vector<vector<int>>& mentors, int pos, int n, int m) {\n        if(pos>=n) {\n            return 0;\n        }\n        int mx = 0;\n        for(int i=0; i<n; i++) {\n            if(!visited[i]) {\n                int cnt = 0;\n                for(int j = 0; j < m; j++) {\n                    if(students[pos][j] == mentors[i][j]) cnt++;\n                }\n                visited[i] = 1;\n                mx = max(mx, cnt+permutation(students, mentors, pos+1, n, m));\n                visited[i] = 0;\n            }\n        }\n        return mx;\n    }\n};\n```
['Backtracking', 'C']