Dsa
Greedy
Easy
Event Scheduling with Costs
You are managing a series of events, each with a start time, end time, and a cost. Your goal is to select a subset of these events such that no two events overlap and the total cost is minimized. Each event is represented as a tuple of (start_time, end_time, cost).
Input:
The first line contains an integer n (1 ≤ n ≤ 100) - the number of events.
The next n lines contain three integers each representing start_time, end_time, and cost (0 ≤ start_time < end_time ≤ 10000, 0 ≤ cost ≤ 1000).
Output:
Print the minimum total cost to attend non-overlapping events.
Example:
Input:
3
1 3 100
2 5 150
4 6 50
Output:
150
Key concepts
greedyoptimization
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now