[c++] next_permutation solution.
\'\'\'\n\nclass Solution {\npublic:\n    int maxCompatibilitySum(vector>& students, vector>& mentors) {\n\t\n        int m = students.size() ;       // number o
\'\'\'\n\nclass Solution {\npublic:\n    int maxCompatibilitySum(vector<vector<int>>& students, vector<vector<int>>& mentors) {\n\t\n        int m = students.size() ;       // number of students\n        int n = students[0].size() ;    // number of questions\n        int chos[m] ;                   // this array select mentors to students\n        iota( chos , chos+m , 0 ) ;     // fill every mentor with the opposite student\n        ll ans = 0 , curans = 0 ; \n        do{\n            curans = 0 ;\n            for ( int i = 0 ; i < m ; i ++ ){\n                for ( int j = 0 ; j < n ; j ++ ){\n                    curans += ( students[i][j] == mentors[chos[i]][j] ) ; // add one if they are equal\n                }\n            }\n            ans = max ( ans , curans ) ;    // if the current answer larger than the answer \n                                            // make the answer equals the current answer        \n        }while ( next_permutation(chos , chos+m ) ) ;   // keep track all the permutations of chos\n        return ans ;\n    }\n};\n\'\'\'\nfill free to ask any questions.
[]