[C++] Recursion + Memorization beats 93%
Time Complexity: O((2^m)nm)\nHelper function if not skipped takes O(mn) and will only be called 2^m times. \n\nclass Solution {\npublic:    \n    int helper(vec
Time Complexity: O((2^m)*n*m)\nHelper function if not skipped takes O(mn) and will only be called 2^m times. \n```\nclass Solution {\npublic:    \n    int helper(vector<vector<int>>& s, vector<vector<int>>& me, int mask, vector<int>& dp){\n        int idx = bitset<8>(mask).count(), m = s.size(), n = s[0].size();\n        if(idx>=m) return 0;\n        if(dp[mask]!=-1) return dp[mask];\n        int ans=0;\n        for(int i=0; i<m; i++){\n            if(mask&(1<<i))continue;\n            int cnt=0;\n            for(int j=0; j<n; j++){\n                if(s[idx][j]==me[i][j]) cnt++;\n            }\n            ans=max(ans,cnt+helper(s, me, mask|(1<<i), dp));\n        }\n        return dp[mask]=ans;\n    }\n    \n    int maxCompatibilitySum(vector<vector<int>>& s, vector<vector<int>>& me) {\n        vector<int> dp(256/*2^8*/, -1);\n        return helper(s, me, 0, dp);\n    }\n};\n```
['Dynamic Programming', 'Memoization', 'C']