Job scheduling maximum profit
You run a single worker that can complete one job per time unit. Job i takes exactly one unit, must finish by its deadline[i] (an integer day, 1-indexed), and pays profit[i] if completed on time. You may schedule at most one job per day. Return the maximum total profit achievable. Constraints: 1 <= n <= 10^5, 1 <= deadline[i] <= n, 0 <= profit[i] <= 10^6.
Implement
max_job_profit(deadline: list[int], profit: list[int]) → intExamples
in
[[2,1,2,1,3],[100,19,27,25,15]]out142What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 35 min
solution.py
InputExpectedGot
[[2,1,2,1,3],[100,19,27,25,15]]142not run yetsample