@@ -0,0 +1,1661 @@
+# Time:  O(mlogm + nlogn), m is the number of workers,%0A#                        , n is the number of jobs%0A# Space: O(n)%0A%0A# We have jobs: difficulty%5Bi%5D is the difficulty of the ith job,%0A# and profit%5Bi%5D is the profit of the ith job.%0A#%0A# Now we have some workers. worker%5Bi%5D is the ability of the ith worker,%0A# which means that this worker can only complete a job with difficulty%0A# at most worker%5Bi%5D.%0A#%0A# Every worker can be assigned at most one job, but one job can be completed%0A# multiple times.%0A#%0A# For example, if 3 people attempt the same job that pays $1, then the total%0A# profit will be $3.%0A# If a worker cannot complete any job, his profit is $0.%0A#%0A# What is the most profit we can make?%0A#%0A# Example 1:%0A#%0A# Input: difficulty = %5B2,4,6,8,10%5D, profit = %5B10,20,30,40,50%5D,%0A# worker = %5B4,5,6,7%5D%0A# Output: 100%0A# Explanation: Workers are assigned jobs of difficulty %5B4,4,6,6%5D and%0A# they get profit of %5B20,20,30,30%5D seperately.%0A#%0A# Notes:%0A# - 1 %3C= difficulty.length = profit.length %3C= 10000%0A# - 1 %3C= worker.length %3C= 10000%0A# - difficulty%5Bi%5D, profit%5Bi%5D, worker%5Bi%5D  are in range %5B1, 10%5E5%5D%0A%0A%0Aclass Solution(object):%0A    def maxProfitAssignment(self, difficulty, profit, worker):%0A        %22%22%22%0A        :type difficulty: List%5Bint%5D%0A        :type profit: List%5Bint%5D%0A        :type worker: List%5Bint%5D%0A        :rtype: int%0A        %22%22%22%0A        jobs = zip(difficulty, profit)%0A        jobs.sort()%0A        worker.sort()%0A        result, i, max_profit = 0, 0, 0%0A        for ability in worker:%0A            while i %3C len(jobs) and jobs%5Bi%5D%5B0%5D %3C= ability:%0A                max_profit = max(max_profit, jobs%5Bi%5D%5B1%5D)%0A                i += 1%0A            result += max_profit%0A        return result%0A

Create most-profit-assigning-work.py