Python | Easy
see the Successfully Accepted Submission\n\n# Code\n\nclass Solution:\n    def maxProfitAssignment(self, difficulty: List[int], profit: List[int], worker: List[
[see the Successfully Accepted Submission](https://leetcode.com/problems/most-profit-assigning-work/submissions/1292080224/?envType=daily-question&envId=2024-06-18)\n\n# Code\n```\nclass Solution:\n    def maxProfitAssignment(self, difficulty: List[int], profit: List[int], worker: List[int]) -> int:\n        # Combine difficulty and profit into a list of tuples and sort them by difficulty\n        jobs = sorted(zip(difficulty, profit))\n        \n        # Sort worker abilities\n        worker.sort()\n        \n        max_profit = 0\n        best = 0\n        i = 0\n        n = len(jobs)\n        \n        for ability in worker:\n            # Increase the best profit up to the current worker\'s ability\n            while i < n and jobs[i][0] <= ability:\n                best = max(best, jobs[i][1])\n                i += 1\n            # Add the best profit the current worker can get\n            max_profit += best\n        \n        return max_profit\n        \n```\n![image](https://assets.leetcode.com/users/images/b1e4af48-4da1-486c-bc97-b11ae02febd0_1696186577.992237.jpeg)
['Python3']