Python3 Easy 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```python3 []\nclass Solution:\n    def maxScore(self, grid: List[List[int]]) -> int:\n        freq={}\n        for i in range (len(grid)):\n            grid[i]= list(set(grid[i]))\n            for j in range(len(grid[i])):\n                if grid[i][j] in freq:\n                    freq[grid[i][j]].append(i)\n                else:\n                    freq[grid[i][j]]=[i]\n\n        newlst = list(sorted(freq.items(),key= lambda x:x[0] ,reverse= True))\n        print(newlst)\n        dp= {}\n        def fun(indx,string):\n            if indx == len(newlst):\n                return 0\n            a = 0 \n            if (indx,string) in dp:\n                return dp[(indx,string)]\n            for row in newlst[indx][1]:\n                # print(string,row)\n                if string[row] == "0":\n                    a= max(a, newlst[indx][0]+ fun(indx+1,string[:row]+"1"+string[row+1:]))\n            a= max(a,fun(indx+1,string))\n            dp[(indx,string)]=a\n            return a\n        return fun(0,"0"*len(grid))\n\n            \n```
['Dynamic Programming', 'Sorting', 'Python3']