Easy Recursive dp solution
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 {\n    int dp[101][102][1200];\n    int solve(int i, int last, int hash, vector<vector<int> >& v) {\n        if (i == -1) {\n            return 0;\n        }\n\n        if(dp[i][last][hash] != -1) return dp[i][last][hash];\n\n        int maxScore = 0;\n        if(v[i][0] < last){\n            if(((hash >> v[i][1]) & 1) == 0){\n                maxScore = max(maxScore, v[i][0] + solve(i-1, v[i][0], hash | (1 << v[i][1]), v));\n            }\n        }\n        maxScore = max(maxScore, solve(i-1, last, hash, v));\n        return dp[i][last][hash] = maxScore;\n    }\n\npublic:\n    int maxScore(vector<vector<int>>& grid) {\n        int n = grid.size(), m = grid[0].size();\n        vector<vector<int> > v;\n        for(int i = 0; i < n; i++){\n            for(int j = 0; j < m; j++){\n                v.push_back({grid[i][j], i});\n            }\n        }\n        sort(v.begin(), v.end());\n        memset(dp, -1, sizeof(dp));\n        return solve(v.size() - 1, 101, 0, v);\n    }\n};\n```
['Dynamic Programming', 'Sorting', 'Bitmask', 'C++']