Bottom Up DP + BitMask || Clean Code || Beats 100% || JAVA
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 []\nclass Solution {\n    public static Set<Integer> EMPTY = Collections.emptySet();\n\n    public int maxScore(List<List<Integer>> grid) {\n        final int n = grid.size(), m = grid.get(0).size();\n        final HashMap<Integer, Set<Integer>> map = new HashMap<>();\n\n        for (int i = 0; i < n; i++) {\n            for (int j = 0; j < m; j++) {\n                final int cur = grid.get(i).get(j);\n\n                map.computeIfAbsent(cur, (x) -> new HashSet<>())\n                    .add(i);\n            }\n        }\n\n        final int[][] dp = new int[102][(1 << n)];\n\n        for (int i = 100; i >= 0; i--) {\n            for (int j = 0; j < (1 << n); j++) {\n\n                int sol1 = 0;\n                int sol2 = dp[i + 1][j];\n\n                for (final int row : map.getOrDefault(i, EMPTY)) {\n                    if ((j & (1 << row)) != 0) continue;\n\n                    sol1 = Integer.max(sol1, i + dp[i + 1][j | (1 << row)]);\n                }\n                \n                dp[i][j] = Integer.max(sol1, sol2);\n            }\n        }\n\n        return dp[0][0];\n    }\n}\n```
['Java']