Maximum Profit in Job Scheduling
Question (LC.1235)
Given n jobs with start time, end time, and profit, find the maximum profit for non-overlapping jobs.
Examples
I:
start_time = [1, 2, 3, 3]
end_time = [3, 4, 5, 6]
profit = [50, 10, 40, 70]
O: 120
I:
startTime = [1, 2, 3, 4, 6]
endTime = [3, 5, 10, 6, 9]
profit = [20, 20, 100, 70, 60]
O: 150Approach
Optimization problem
A simple exchange greedy argument is not enough because the weight is hard to swap
DP approach

Code
Time Complexity
O(nlogn) for sorting O(n) space
Last updated