Python3 solution using dp ||  O(max(n,max(difficulty))
\n# Written with love by atm1504\nclass Solution:\n    def maxProfitAssignment(self, difficulty: List[int], profit: List[int], worker: List[int]) -> int:\n     
```\n# Written with love by atm1504\nclass Solution:\n    def maxProfitAssignment(self, difficulty: List[int], profit: List[int], worker: List[int]) -> int:\n        n=len(profit)\n        maxm=max(difficulty)\n        dp=[0]*(1+maxm)\n        for i in range(n):\n            dp[difficulty[i]]=max(dp[difficulty[i]],profit[i])\n        for i in range(1,maxm+1):\n            dp[i]=max(dp[i],dp[i-1])\n        res=0\n\n        for x in worker:\n            if x>maxm:\n                res+=dp[maxm]\n            else:\n                res+=dp[x]\n        return res\n```
[]