✅✔️Easy to understand C++ Solution using Backtracking ✈️✈️✈️✈️✈️
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int ans = 0;\n    int score(vector<int>&v1, vector<int>&v2, int m){\n        int cnt = 0;\n        for(int i=0; i<m; i++){\n            cnt += (v1[i] == v2[i]);\n        }\n        return cnt;\n    }\n    void solve(int idx, vector<int>&arr, vector<vector<int>>& ss , vector<vector<int>>& mrs, int n, int m){\n        if(idx == arr.size()){\n            int sum = 0;\n            for(int i=0; i<n; i++){\n                sum += score(ss[i],mrs[arr[i]],m);\n            }\n            ans = max(ans,sum);\n            return;\n        }\n        for(int i=idx; i<arr.size(); i++){\n            swap(arr[idx],arr[i]);\n            solve(idx+1,arr,ss,mrs,n,m);\n            swap(arr[idx],arr[i]);\n        }\n    }\n    \n    int maxCompatibilitySum(vector<vector<int>>& students, vector<vector<int>>& mentors) {\n        int n = students.size();\n        int m = students[0].size();\n        vector<int>arr(n);\n        for(int i=0; i<n; i++) arr[i] = i;\n        solve(0,arr,students,mentors,n,m);\n        return ans;\n    }\n};\n```
['Array', 'Dynamic Programming', 'Backtracking', 'C++']