2dbi
Home/Snowflake/Maximum Profit in Job Scheduling
SSnowflake·DSASDE-2Technical Phone Screen

Maximum Profit in Job Scheduling

Problem

Given jobs with start, end, and profit, pick non-overlapping jobs maximizing total profit.

Example

start=[1,2,3,3], end=[3,4,5,6], profit=[50,10,40,70] -> 120

Constraints

  • 1 ≤ n ≤ 5 × 10^4

Approach

Sort by end, DP + binary search for the last compatible job.

added 6 days ago
LeadersAccount