C++||Backtracking ||Recursive||Easy to Understand
```\nclass Solution {\npublic:\n    int ans=0;\n    void backtrack(vector>& students, vector>& mentors,int idx,int curr_res,vector &vis)\n    {\n        if(idx>
```\nclass Solution {\npublic:\n    int ans=0;\n    void backtrack(vector<vector<int>>& students, vector<vector<int>>& mentors,int idx,int curr_res,vector<int> &vis)\n    {\n        if(idx>=mentors.size())\n        {\n            ans=max(ans,curr_res);\n                return ;\n        }\n        for(int i=0;i<students.size();i++)\n        {\n            if(vis[i]!=0)\n                continue;\n            int temp=0;\n            vis[i]=1;\n            for(int j=0;j<students[i].size();j++)\n            {\n                if(students[i][j]==mentors[idx][j])\n                {\n                    temp++;\n                }\n            }\n            backtrack(students,mentors,idx+1,curr_res+temp,vis);\n            vis[i]=0;\n        }\n    }\n    int maxCompatibilitySum(vector<vector<int>>& students, vector<vector<int>>& mentors)\n    {\n        vector<int> vis(students.size(),0);\n        backtrack(students,mentors,0,0,vis);\n        return ans;\n        \n        \n    }\n};\n// if you like the solution plz upvote.
['Backtracking', 'Recursion', 'C']