Each job takes exactly one time slot and is given as [deadline, profit]: it earns profit only if it is done in slot 1, 2, ..., or deadline. Only one job can run per slot. Return the maximum total profit.
Examples
Input: jobs = [[2, 100], [1, 19], [2, 27], [1, 25], [3, 15]]
Output: 142
Explanation: Slot 1: profit 27, slot 2: profit 100, slot 3: profit 15.
Input: jobs = [[1, 5], [1, 7], [1, 9]]
Output: 9
Constraints
0 <= len(jobs) <= 5 * 10**4,1 <= deadline <= 10**9,0 <= profit <= 10**6.- Target complexity: O(n log n).
Goals
- Sort jobs by deadline and admit them one at a time
- Use a min-heap to evict the least valuable job when a deadline would be violated