š” Schedule jobs before their deadlines to maximize profit! Sort by
profit first.
š
Schedule (Time Slots)
š¼ Available Jobs (sorted by profit)
š Job Scheduling with Deadlines
Each job has a profit and deadline. Schedule to maximize total profit:
- Sort jobs by profit in descending order
- For each job, find the latest free slot before its deadline
- If a slot is available, schedule the job there
- Skip jobs that can't be scheduled
- Time: O(n²) or O(n log n) with union-find