Naive Brute Force Using next_permutation(68ms)
Here is a pretty naive implementation ,hope it helps\n```\nclass Solution {\npublic:\n    int maxCompatibilitySum(vector>& student, vector>& mentors) {\n       
Here is a pretty naive implementation ,hope it helps\n```\nclass Solution {\npublic:\n    int maxCompatibilitySum(vector<vector<int>>& student, vector<vector<int>>& mentors) {\n        int m=student.size();\n        int n=student[0].size();\n        //This matrix com stores the compatibility score between i th student and jth mentor\n        int com[m][m];\n        memset(com,0,sizeof com);\n        //We fill out every student-teacher compatibility scores\n        for(int i=0;i<m;i++)\n            for(int j=0;j<m;j++)\n            {\n                int   res=0;\n                for(int k=0;k<n;k++)\n                {\n                    res+=(student[i][k]==mentors[j][k]);\n                }\n                com[i][j]=res;\n            }\n        //allot vector is used to assign students to mentors in such a way that every student is assigned to one teacher\n        //We try out every such possibility using next_permutation\n        //For example if we have 5 students initially the allot=[0,1,2,3,4]\n        //which means ith student is assigned to allot[i] teacher \n        \n        vector<int> allot;\n        for(int i=0;i<m;i++) allot.push_back(i);\n        int ans=0;\n        for(int i=0;i<m;i++) ans+=(com[i][allot[i]]);\n        //Here we check every possible assignment of m students to m teachers\n        do{  int temp=0;\n            for(int i=0;i<m;i++) temp+=(com[i][allot[i]]);\n           ans=max(ans,temp);\n                \n        }while(next_permutation(allot.begin(),allot.end()));\n        return ans;\n        \n    }\n}
['C']