Easy Java 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```java []\nimport java.util.*;\n\nclass Solution {\n    int[][] dp = new int[2001][101];\n\n    int solve(int i, int n, List<Integer> t, Map<Integer, List<Integer>> mp, int mask) {\n        if (i == n) return 0;\n        if (dp[mask][i] != -1) return dp[mask][i];\n\n        int ans = 0;\n        for (int j : mp.get(t.get(i))) {\n            if ((mask & (1 << j)) == 0) {\n                ans = Math.max(ans, t.get(i) + solve(i + 1, n, t, mp, (mask | (1 << j))));\n            }\n        }\n        ans = Math.max(ans, solve(i + 1, n, t, mp, mask));\n        return dp[mask][i] = ans;\n    }\n\n    public int maxScore(List<List<Integer>> v) {\n        int n = v.size();\n        int m = v.get(0).size();\n        Set<Integer> s = new HashSet<>();\n\n        for (int i = 0; i < n; i++) {\n            for (int j = 0; j < m; j++) {\n                s.add(v.get(i).get(j));\n            }\n        }\n\n        List<Integer> t = new ArrayList<>(s);\n        Collections.sort(t, Collections.reverseOrder());\n\n        Map<Integer, List<Integer>> mp = new HashMap<>();\n        for (int i = 0; i < n; i++) {\n            for (int j = 0; j < m; j++) {\n                mp.computeIfAbsent(v.get(i).get(j), k -> new ArrayList<>()).add(i);\n            }\n        }\n\n        for (int[] row : dp) {\n            Arrays.fill(row, -1);\n        }\n\n        return solve(0, t.size(), t, mp, 0);\n    }\n}\n\n```
['Java']