1235. Maximum Profit in Job Scheduling (Hard) - TengnanYao/daily_leetcode GitHub Wiki
class Solution:
def jobScheduling(self, startTime: List[int], endTime: List[int], profit: List[int]) -> int:
arr = list(zip(startTime, endTime, profit))
arr.sort(key = lambda x : x[1])
dp = [0, 0](/TengnanYao/daily_leetcode/wiki/0,-0)
for a, b, p in arr:
i = bisect_right(dp, [a, inf])
dp.append([b, max(dp[-1][1], dp[i - 1][1] + p)])
return dp[-1][1]