Beats 100 % user in Python : Checkout the only one Quality code :
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```python3 []\nclass Solution:\n    def maxScore(self, grid: List[List[int]]) -> int: \n        H = [set([]) for i in range(101)]\n        n = len(grid)\n        m = len(grid[0])\n        for i in range(n):\n            for j in range(m):\n                H[grid[i][j]].add(2**i)\n        d = [0 for i in range(2**10)]\n        for i in range(101):\n            new_d = [x for x in d]\n            for x in range(2**10):\n                for y in H[i]:\n                    if y|x != x:\n                        x2 = y|x\n                        new_d[x2] = max(new_d[x2], i+d[x])\n            d = new_d\n        return max(d)\n```
['Python3']