Dsa
Greedy
Medium
Efficient Conference Scheduling
You are organizing a conference with multiple sessions that each have a specific start and end time. Due to constraints, you can only attend non-overlapping sessions. Your goal is to select the maximum number of sessions you can attend. Write a program that reads the list of sessions and outputs the maximum number of non-overlapping sessions you can attend.
Input format:
- The first line contains an integer S (1 ≤ S ≤ 1000), the number of sessions.
- The next S lines each contain two integers T1 (1 ≤ T1 ≤ 1000) and T2 (T1 < T2 ≤ 2000), representing the start and end time of each session.
Output format:
- A single integer representing the maximum number of non-overlapping sessions.
Example:
Input:
5
1 3
2 5
4 6
7 8
5 8
Output:
3
Key concepts
greedyschedulinginterval management
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