Dp with Bitmasking || Bit Manipulation || Recursion || C++
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```cpp []\nclass Solution {\npublic:\n\n    int dp[101][1025];\n    unordered_map<int,vector<int>> m;\n    \n    int f(int i,int mask)\n    {\n        if(i==0)\n         return 0;\n        if(dp[i][mask]!=-1)\n         return dp[i][mask];\n      \n       int ans=f(i-1,mask);\n\n       for(auto& x:m[i])\n       {\n          if((mask>>x)&1)\n           continue;\n         ans=max(ans,i+f(i-1,mask|(1<<x)));\n       }\n\n       return dp[i][mask]=ans;\n\n    }\n    int maxScore(vector<vector<int>>& a) {\n        \n        memset(dp,-1,sizeof(dp));\n        int mx=1;\n        for(int i=0;i<a.size();i++)\n        {\n            for(auto& x:a[i])\n            {\n             m[x].push_back(i);\n             mx=max(mx,x);\n            }\n            \n        }\n\n        return f(mx,0);\n\n         \n    }\n};\n```
['Dynamic Programming', 'Recursion', 'Bitmask', 'C++']