Maximum Profit in Job Scheduling
We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i]. Return the maximum profit you can take such that there are no two jobs with overlapping time ranges.

30:00

Maximum Profit in Job Scheduling
hard
Topics
Companies

We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i]. Return the maximum profit you can take such that there are no two jobs with overlapping time ranges.

Example 1:
Input: {"startTime":[1,2,3,3],"endTime":[3,4,5,6],"profit":[50,10,40,70]}
Output: 120
Constraints:
  • 1startTime.length==endTime.length==profit.length5×1041 \leq \text{startTime.length} == \text{endTime.length} == \text{profit.length} \leq 5 \times 10^4

  • 1startTime[i]<endTime[i]1091 \leq \text{startTime}[i] < \text{endTime}[i] \leq 10^9

  • 1profit[i]1041 \leq \text{profit}[i] \leq 10^4

Input
arr ={"startTime":[1,2,3,3],"endTime":[3,4,5,6],"profit":[50,10,40,70]}

Given 4 jobs. Sort by start time.

State
jobs
["[1, 3] profit=50", "[2, 4] profit=10", "[3, 5] profit=40", "[3, 6] profit=70"]
Variables
No variables to display
DepthFunction Call
Stack empty
0/5