Job scheduling maximum profit

Write codeHard35 min

Your task

You run a single-server batch system. Each job is given as [deadline, profit], takes exactly one time unit, and earns its profit only if it finishes at or before its integer deadline (slots are 1..deadline). At most one job can occupy a time slot. Return the maximum total profit achievable by choosing a feasible subset and an order. Deadlines and profits are positive; the list may be empty.

Examples

job_scheduling_profit(jobs: list[list[int]]) -> int
Example 1
Inputjob_scheduling_profit([[4, 70], [1, 80], [1, 30], [1, 20]])
Output150