Maximize Workshop Invitations
Preview mode. Log in to edit, run, submit, and save progress.
Hard
Maximize Workshop Invitations
You are building an invitation calendar for a learning week. Each workshop is represented as [startDay, endDay, impact]. If you invite a workshop, every day from startDay through endDay is blocked. You may invite at most k workshops. Two invited workshops are compatible only when they do not share any day. Return the maximum total impact you can collect.
Examples
Example 1
Input:
workshops = [[1,2,5],[4,5,7],[2,4,9]], k = 2
Output:
12
Explanation: Pick [1,2,5] and [4,5,7].
Approach hint
Two workshops are compatible only if the earlier end day is strictly less than the later start day.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.
solution.cpp